I am new to this, and facing a problem I am looking for correct vba code for Access to prevent duplicate entry, with message alert. Following code works very good but problem with this is "if Lower case to upper case or vice versa" is changed, this code does not recognise and accepts the entry.
In my table field name is "Cat_No", table name is "ArticlesDetails"
Private Sub TextCat_No_BeforeUpdate(Cancel As Integer)
If Me.TextCat_No.Value = DLookup("[Cat_No]", "ArticlesDetails", "[Cat_No] = '" & Me.TextCat_No.Value & "'") Then
Cancel = True
MsgBox "This Catalogue number already exists, Duplicate entry not allowed", vbCritical, "Duplicate Entry"
End If
End Sub
For Example if Cat_No "T330" already exists, but if user changes to "t330" it is accepted by the system.
I can change the table field index "Duplicate no" but I want to present a message to users as above.