demogorgan
Registered User.
- Local time
- Today, 17:02
- Joined
- Nov 29, 2017
- Messages
- 37
Hi,
So I have a database that users enter order details into - but I do not wish to have duplicate records.
I have prevented that by the following code in the before update portion of the database.
This works great, however when I try to edit the record it fires the above code - is there a way of allowing edits but still blocking duplicate values?
Thanks in advance
Demo
So I have a database that users enter order details into - but I do not wish to have duplicate records.
I have prevented that by the following code in the before update portion of the database.
Code:
Dim Answer As Variant
Answer = DLookup("[Order_Number]", "tblOrder_Details", "[Order_Number] = '" & Me.Order_Number & "'")
If Not IsNull(Answer) Then
MsgBox "Duplicate Order Number Found" & vbCrLf & "Please enter again.", vbCritical + vbOKOnly + vbDefaultButton1, "Duplicate"
Cancel = True
Me.Order_Number.Undo
Thanks in advance
Demo