Unanswered: How do you trap an error when opening a form?
(Access 2003) I keep getting errors when opening a form that is filtered to find a specific record/account number and when the record/account number isn't entered yet. I used the wizard to "Open a Form" - (with specific information to find). When the button is clicked an error message:
Syntax error (missing operator) in query expression '[AccountNo]='1234-123".
I want to trap this error and cause the form to open and add a new record (utilizing the account number in the new record) when ever this condition occurrs, or display a message on the screen "Account Number 1234-123 Not found - Do you want to add it?".
Can this happen in the command button click event?
As I stated before, I let the wizard create the filter when it asked if I wanted to open the form to find specific data. I saw that the error message did not look like the filter call and was wondering if this is a bug in Access error processing? However, the VBA code for the button looks correct:
Private Sub cmdOpenContractForm_Click()
On Error GoTo Err_cmdOpenContractForm_Click
Dim stDocName As String
Dim stLinkCriteria As String