J
JIM
I'm trying to make a function work found on-line. My module looks like this:
Option Compare Database
Public Const SW_Hide = 0
Public Const SW_Minimize = 6
Public Const SW_Restore = 9
Public Const SW_Show = 5
Public Const SW_ShowMazimized = 3
Public Const SW_ShowMinimized = 2
Public Const SW_ShowMinnoActive = 7
Public Const SW_Showna = 8
Public Const SW_ShownoActivate = 4
Public Const SW_ShowNormal = 1
Public Declare Function ShellExecute Lib "Shell32.dll" Alias "ShellExecuteA"
(ByVal hWnd As Long, ByVal IpOperation As String, ByVal IpParameters As
String, ByVal IpDirectory As String, ByVal nShowCmd As Long) As Long
Public Sub ExecuteFile(sFileName As String, sAction As String) 'sAction can
be either "Open" or "Print"
Dim vReturn As Long
If ShellExecute(Access.hWndAccessApp, sAction, sFileName, vbNullString,
SW_ShowNormal) < 33 Then
MsgBox "File not found"
End If
End Sub
Then in my click event on a form the code looks like this:
Private Sub Option62_Click()
sFileName = Me.txtMapLoc
vReturn = ExecuteFile(sFileName, "Print")
End Sub
I get "Compile error: Byref argument type mismatch" And after thinking -
it's probably saying this is not a file name, which it is not. The control
txtMapLoc has in it the location of the file (ie Flans\Xcel.doc) not the
file name. How can I implement this function using the location?
Thanks,
JIM
Option Compare Database
Public Const SW_Hide = 0
Public Const SW_Minimize = 6
Public Const SW_Restore = 9
Public Const SW_Show = 5
Public Const SW_ShowMazimized = 3
Public Const SW_ShowMinimized = 2
Public Const SW_ShowMinnoActive = 7
Public Const SW_Showna = 8
Public Const SW_ShownoActivate = 4
Public Const SW_ShowNormal = 1
Public Declare Function ShellExecute Lib "Shell32.dll" Alias "ShellExecuteA"
(ByVal hWnd As Long, ByVal IpOperation As String, ByVal IpParameters As
String, ByVal IpDirectory As String, ByVal nShowCmd As Long) As Long
Public Sub ExecuteFile(sFileName As String, sAction As String) 'sAction can
be either "Open" or "Print"
Dim vReturn As Long
If ShellExecute(Access.hWndAccessApp, sAction, sFileName, vbNullString,
SW_ShowNormal) < 33 Then
MsgBox "File not found"
End If
End Sub
Then in my click event on a form the code looks like this:
Private Sub Option62_Click()
sFileName = Me.txtMapLoc
vReturn = ExecuteFile(sFileName, "Print")
End Sub
I get "Compile error: Byref argument type mismatch" And after thinking -
it's probably saying this is not a file name, which it is not. The control
txtMapLoc has in it the location of the file (ie Flans\Xcel.doc) not the
file name. How can I implement this function using the location?
Thanks,
JIM