Hi, this is the vba code that I am using to prevent double entry. It actually works well. Unfortunately, there is still one problem, take a look in my example:
Recorded entry: Jhon's Laundry Shop
New entry: Jhon's laundry Shop
In this case, Access accepts the NEW entry if I make changes (uppercase to lowercase) vise versa in the name of the entry. How can we improve the code to prevent this from happening?
Dim NewBusinessName As String
Dim stlinkcriteria As String
NewBusinessName = Me.BusinessName.Value
stlinkcriteria = "[BusinessName] = " & Chr(34) & NewBusinessName & Chr(34)
If Me.BusinessName = DLookup("[BusinessName]", "Sheet1", stlinkcriteria) Then
MsgBox "" & NewBusinessName & " is already in the Database." _
& vbCr & vbCr & "Data Entry Denied!!!", vbInformation, "DUPLICATE ENTRY"
Me.Undo 'undo the process and clear all fields