I have the following VBA code in a form
'Check for duplicates based on LName and warn
Private Sub LName_BeforeUpdate(Cancel As Integer)
'Find any matching records based on FName & LName
If DCount("*", "Tbl_Contacts", "[FName] & [LName] = '" & Me.[FName] & Me.[LName] & "'") > 0 Then
'If DCount > 0 then a matching record was found & display a Yes/No message box.
If MsgBox("Warning: Possible Duplicate! Continue?", vbYesNo, "Possible Duplicate!") = vbNo Then
'If the user clicked No, cancel the update & undo whatever was typed
Cancel = True
Me.Undo
End If
End If
End Sub
When I try to enter a new LName that contains an apostrophe the Form stands still and doesn't let me move on unless I change the apostrophe to another symbol. How can I tell my form to allow apostrophes?
Thanks!
'Check for duplicates based on LName and warn
Private Sub LName_BeforeUpdate(Cancel As Integer)
'Find any matching records based on FName & LName
If DCount("*", "Tbl_Contacts", "[FName] & [LName] = '" & Me.[FName] & Me.[LName] & "'") > 0 Then
'If DCount > 0 then a matching record was found & display a Yes/No message box.
If MsgBox("Warning: Possible Duplicate! Continue?", vbYesNo, "Possible Duplicate!") = vbNo Then
'If the user clicked No, cancel the update & undo whatever was typed
Cancel = True
Me.Undo
End If
End If
End Sub
When I try to enter a new LName that contains an apostrophe the Form stands still and doesn't let me move on unless I change the apostrophe to another symbol. How can I tell my form to allow apostrophes?
Thanks!