Hi,
I have a stock database and have recently solved an issue with duplication.
When a user enters a duplicate value in the 'DAMS_Number' field on a form, a message box alerts the user that the value already exists.
What I would like is for the form to display the corresponding record as soon as the user clicks 'Ok' on the message box.
The code I have for the duplicate alert (which I obtained from this site btw!) is as follows:
Can anybody help me with this?
Thanks!
I have a stock database and have recently solved an issue with duplication.
When a user enters a duplicate value in the 'DAMS_Number' field on a form, a message box alerts the user that the value already exists.
What I would like is for the form to display the corresponding record as soon as the user clicks 'Ok' on the message box.
The code I have for the duplicate alert (which I obtained from this site btw!) is as follows:
Code:
Private Sub DAMS_Number_AfterUpdate() Dim tmpID As Long tmpID = Nz(DLookup("[DAMS Number]", "DAMS Stock", "[DAMS Number]=" & Me!DAMS_Number), 0) If tmpID <> 0 Then MsgBox "This DAMS asset already exists in the database", vbOKOnly End If End Sub
Thanks!
Comment