I have a strange problem. I have some code in the before update event of a form that checks for duplicate values. If it finds duplicates it warns the user with a message and sets cancel to true.
All this works great unless they try to x out of the form. When that happens, they get the warning message PLUS the "You cannot save this record at this time" message.
Here's the simple code:
If DCount("*", "tblTeacherAssistants", "LastName = """ & LastName & """ and FirstName = """ & FirstName & """ and SiteID = " & SiteID) > 0 Then
MsgBox "The combination of Last Name, First Name and Site has already been entered. To back out of this entry, please press Esc." & vbCrLf & vbCrLf & "You can use the Find and Filter features at the top of this form to find the entered Teacher Assistant.", vbCritical
Cancel = True
It feels like I've done this a thousand times and never got this message.
I would like to allow the user to simply x out of the form and let the data be saved by default.
Can some one help me on how to do this.