Hi,
can anyone tell me why the following doesn't work?
It was, as you can see, generated by the command button wizard and I then went back in and jigged the code to make it dynamic based on the selected record on the form. I know it generates a correct path, but I get then "Invalid procedure call or argument error" whenever I run it. This happens even if I manually type the path into the code.
On the other hand, if I put "calc" as the path it runs calc perfectly. So it's something in the variable, but I can't see what.
Thanks
Nick
can anyone tell me why the following doesn't work?
Code:
Private Sub cmdOpenFile_Click()
On Error GoTo Err_cmdOpenFile_Click
Dim stAppName
Dim docType As Integer
Dim ext As String
docType = DLookup("documentType", "tblDocuments", "documentID = '" & Me.documentID.Value & "'")
ext = DLookup("extension", "tblDocTypes", "docTypeID = '" & docType & "'")
stAppName = Me.documentPath.Value & "\" & Me.documentName.Value & "." & ext
Call Shell(stAppName, vbNormalFocus)
Exit_cmdOpenFile_Click:
Exit Sub
Err_cmdOpenFile_Click:
MsgBox Err.Description
Resume Exit_cmdOpenFile_Click
End Sub
It was, as you can see, generated by the command button wizard and I then went back in and jigged the code to make it dynamic based on the selected record on the form. I know it generates a correct path, but I get then "Invalid procedure call or argument error" whenever I run it. This happens even if I manually type the path into the code.
On the other hand, if I put "calc" as the path it runs calc perfectly. So it's something in the variable, but I can't see what.
Thanks
Nick