Hi
Iam importing a text file by running a macro (access 2000), when a command button is clicked. If the file is not found I receive an error message "the jet enjine cannot find the file make sure the name is spell correctly etc. The problem is that if on click I first run a message box to allow the user the option to cancel the command. I don't get the error message, I want the error message to show if the files is not there.
This is my code. I did try to add an onerror goto , but then I recieved the erro message that I typed whether the file is found or not.
Private Sub ImportTextFile_Click()
Dim Msg, Style, Title, Response, MyString
Msg = "You are about to Import an OverDue text file that will Replace your current File. Do you want to Continue ?" ' Define message.
Style = vbYesNo + vbCritical + vbDefaultButton2 ' Define buttons.
Title = "Caution" ' Define title.
' context.
' Display message.
Response = MsgBox(Msg, Style, Title)
If Response = vbYes Then ' User chose Yes.
DoCmd.RunMacro "ImportReport"
' Perform some action.
Else
Exit Sub
End If
exit sub
Iam importing a text file by running a macro (access 2000), when a command button is clicked. If the file is not found I receive an error message "the jet enjine cannot find the file make sure the name is spell correctly etc. The problem is that if on click I first run a message box to allow the user the option to cancel the command. I don't get the error message, I want the error message to show if the files is not there.
This is my code. I did try to add an onerror goto , but then I recieved the erro message that I typed whether the file is found or not.
Private Sub ImportTextFile_Click()
Dim Msg, Style, Title, Response, MyString
Msg = "You are about to Import an OverDue text file that will Replace your current File. Do you want to Continue ?" ' Define message.
Style = vbYesNo + vbCritical + vbDefaultButton2 ' Define buttons.
Title = "Caution" ' Define title.
' context.
' Display message.
Response = MsgBox(Msg, Style, Title)
If Response = vbYes Then ' User chose Yes.
DoCmd.RunMacro "ImportReport"
' Perform some action.
Else
Exit Sub
End If
exit sub