G
Guest
hi,
I have the following in a module saves as Module1:
Option Compare Database
Option Explicit
Declare Function ShellExecute Lib "shell32.dll" Alias "ShellExecuteA" (ByVal
Hwnd As Long, ByVal lpOperation As String, ByVal lpFile As String, ByVal
lpParameters As String, ByVal lpDirectory As String, ByVal nShowCmd As Long)
As Long
Global Const SW_SHOWNORMAL = 1
Public Function StartDoc(DocName As String)
On Error GoTo StartDoc_Error
StartDoc = ShellExecute(Application.hWndAccessApp, "Open", DocName,
"", "C:\", SW_SHOWNORMAL)
Exit Function
StartDoc_Error:
MsgBox "Error: " & Err & " " & ERROR
Exit Function
End Function
Then I have a button in a form, with the following code behind it. WHen I
clicked the button to see if the code would open the "put.txt" file on my C
Drive, I got an "compile error: argument not optional" error message. How
can I fix this?
Here is te code bhing the button:
StartDoc
DocName = "put.txt"
Thanks in advance,
geebee
I have the following in a module saves as Module1:
Option Compare Database
Option Explicit
Declare Function ShellExecute Lib "shell32.dll" Alias "ShellExecuteA" (ByVal
Hwnd As Long, ByVal lpOperation As String, ByVal lpFile As String, ByVal
lpParameters As String, ByVal lpDirectory As String, ByVal nShowCmd As Long)
As Long
Global Const SW_SHOWNORMAL = 1
Public Function StartDoc(DocName As String)
On Error GoTo StartDoc_Error
StartDoc = ShellExecute(Application.hWndAccessApp, "Open", DocName,
"", "C:\", SW_SHOWNORMAL)
Exit Function
StartDoc_Error:
MsgBox "Error: " & Err & " " & ERROR
Exit Function
End Function
Then I have a button in a form, with the following code behind it. WHen I
clicked the button to see if the code would open the "put.txt" file on my C
Drive, I got an "compile error: argument not optional" error message. How
can I fix this?
Here is te code bhing the button:
StartDoc
DocName = "put.txt"
Thanks in advance,
geebee