Hello everyone.
I am having a problem with my Access VBA. Using a button on my database, I want to open a Word document that has been created and named using the auto number system in Access (eg, auto number 3448, Word document name 3448.doc). I am using the following code:
Private Sub RetreiveScreenDumps_Click()
On Error GoTo Err_RetreiveScreenDumps_Click
Dim stAppName As String
stAppName = "C:\Program Files\Microsoft Office\Office10\WINWORD.EXE N:\SMDiv\Insurance\MemberRelations\FileManagement\ SystemReferrals\" & Forms![SystemReferralActionFrm]![SystemReferralTbl.JobNumber] & ".doc"
Call Shell(stAppName, 1)
Exit_RetreiveScreenDumps_Click:
Exit Sub
Err_RetreiveScreenDumps_Click:
MsgBox Err.Description
Resume Exit_RetreiveScreenDumps_Click
End Sub
The problem is, when Word opens I get an error message saying "The document name or path is invalid". I know there is a simple fix to this, but can not figure out what to do.
Any help would be greatly appreciated.
I am having a problem with my Access VBA. Using a button on my database, I want to open a Word document that has been created and named using the auto number system in Access (eg, auto number 3448, Word document name 3448.doc). I am using the following code:
Private Sub RetreiveScreenDumps_Click()
On Error GoTo Err_RetreiveScreenDumps_Click
Dim stAppName As String
stAppName = "C:\Program Files\Microsoft Office\Office10\WINWORD.EXE N:\SMDiv\Insurance\MemberRelations\FileManagement\ SystemReferrals\" & Forms![SystemReferralActionFrm]![SystemReferralTbl.JobNumber] & ".doc"
Call Shell(stAppName, 1)
Exit_RetreiveScreenDumps_Click:
Exit Sub
Err_RetreiveScreenDumps_Click:
MsgBox Err.Description
Resume Exit_RetreiveScreenDumps_Click
End Sub
The problem is, when Word opens I get an error message saying "The document name or path is invalid". I know there is a simple fix to this, but can not figure out what to do.
Any help would be greatly appreciated.