G
Guest
I tried using some code from someone else's post but it does not work. I simply want to return a custom error message when a duplicate record is entered into a table from a field.
My Table is called "Chemicals
My Form is called "ChemicalLocations
The control on my form is called "ChemName" (From Chemicals Table. ChemName is also indexed
The code I tried in A2003 was applied to the control ChemName on after_update in the ChemicalLocations Form (code follows) but it keeps returning an error message "Runtime Error 2001. You canceled your previous operation". Any help? Thx
Private Sub ChemName_AfterUpdate(
If Not IsNull(DLookup("[ChemName]", "[Chemicals]", "[ChemName] = " & Me.ChemName)) The
End I
End Sub
My Table is called "Chemicals
My Form is called "ChemicalLocations
The control on my form is called "ChemName" (From Chemicals Table. ChemName is also indexed
The code I tried in A2003 was applied to the control ChemName on after_update in the ChemicalLocations Form (code follows) but it keeps returning an error message "Runtime Error 2001. You canceled your previous operation". Any help? Thx
Private Sub ChemName_AfterUpdate(
If Not IsNull(DLookup("[ChemName]", "[Chemicals]", "[ChemName] = " & Me.ChemName)) The
End I
End Sub