Hello,
I am using the following to search for duplicate text strings in a before update event on a form. I just want to allow the user to be aware of the duplicate value...these values do not have to be unique. The user needs to be able to save duplicate values if they want.
This works for the most part. But when I search for strings with an apostrophe, I cannot tab out of the control. I have tried a few other special characters which seem to be ok but I haven't tried everything.
Is there some modification to the code that would allow the search to include ANY character?
Thanks in advance!
I am using the following to search for duplicate text strings in a before update event on a form. I just want to allow the user to be aware of the duplicate value...these values do not have to be unique. The user needs to be able to save duplicate values if they want.
Code:
Private Sub ProjName_BeforeUpdate(Cancel As Integer)
If DCount("*", "tblInvoices", "ProjName='" & Me.ProjName & "'") > 0 Then
If MsgBox("Duplicate exists. Continue?", vbQuestion + vbYesNo,
"Duplicate") = vbNo Then
Me.ProjName.Undo
Cancel = True
End If
End If
End Sub
This works for the most part. But when I search for strings with an apostrophe, I cannot tab out of the control. I have tried a few other special characters which seem to be ok but I haven't tried everything.
Is there some modification to the code that would allow the search to include ANY character?
Thanks in advance!