I have an old 2003 (mdb) Access database that I am working on (I currently have Access 2007). We still have some users who use Access 2003, so we have not updated/converted it yet (the database is split into back/front-ends).
I have created a few new forms. First, I have a Selection Form where the users enters in the criteria to bring up their particular clients data. In then opens up a Continuous Form for data entry. I placed a Close/Exit command button in the Form Footer. If I use the Command Button Wizard for this buton, it creates the following code:
Code:
Private Sub cmdClose_Click()
On Error GoTo Err_cmdClose_Click
If Me.Dirty Then Me.Dirty = False
DoCmd.Close
Exit_cmdClose_Click:
Exit Sub
Err_cmdClose_Click:
MsgBox Err.Description
Resume Exit_cmdClose_Click
End Sub
When I first created it, it worked. But now when we try to use this button, we get the following error message:
The expression On Click you entered as the event property setting prodcued the following error: A problem occurred while Microsoft Office Access was communicating with the OLE server or ActiveX Control.
*The expression may not result in the name of a macro, the name of a user-defined function, or [Event Procedure].
*There may have been an error evaluating the function, event, or macro.
I tried simplying my code to these variations, but it made no difference:
Code:
Private Sub cmdClose_Click()
DoCmd.Close
End Sub
Code:
Private Sub cmdClose_Click()
DoCmd.Close acForm, Me.Name
End Sub
I have searched the internet, and found various posts on the topic, but haven't found one yet that seems to apply to my situation.
I should also add, if they just click on the "X" in the upper right-hand corner, the form closes without issue. It just doesn't seem to like the Close/Exit command button anymore.
Any ideas?