chrisjames25
Registered User.
- Local time
- Today, 17:17
- Joined
- Dec 1, 2014
- Messages
- 404
Hi
I have the following code in a form to check whether the string being inputted already exsits in the data:
Works great until i search for a O'Neil or anything like that. The apostrophe will make it say it exists even if product doesn't.
Assume this is cos it is a delimiter symbol but not sure how to change my code to sort the issue. Cheers
I have the following code in a form to check whether the string being inputted already exsits in the data:
Code:
On Error Resume Next
Dim msg, style, title, response, MyString, field, source, criteria
If Len(Me.Txt_NewTier2.Value & vbNullString) = 0 Then
Else
If DCount("Genus", "Tbl_Genus", "Genus='" & Txt_NewTier2 & "' AND Category_ID= " & Me.Cbo_Tier1) > 0 Then
msg = "This " & StrTier22 & " already exists within the selected " & StrTier11
style = vbOKOnly + vbExclamation
title = StrTier2 & " Duplicate Error"
response = MsgBox(msg, style, title)
Me.Txt_NewTier2.Value = vbNullString
' Me.SrchText.Value = vbNullString
Me.Form.Requery
Me.Txt_NewTier2.SetFocus
Me.Txt_ConfirmTier2.Enabled = False
Exit Sub
End If
End If
Works great until i search for a O'Neil or anything like that. The apostrophe will make it say it exists even if product doesn't.
Assume this is cos it is a delimiter symbol but not sure how to change my code to sort the issue. Cheers