Display a message box "this entry is a duplicate"
Am 03.06.2010 19:32, schrieb Tina:
How can I display a message box on a form if the shipment number is a
duplicate? I need a message box to pop up when user attempts to tab out of
the field.
Thank you.
Hello,
try something like this in when the control is about to lose it´s focus.
Dim intZ as Integer
intZ = DCount("FieldinTable","Tablename","shipmentnumber = " &
Me.Yournewnumber)
If intZ = 1 Then
Me.Yournewnumber.Undo
MsgBox "number already exists"
shipmentnumber is the name of the column in your table with the numbers
you want to check. This will work if your shipment number is an integer.
Me.Yurnewnumber is the name of your textfield in the form.
Regards
Jörn
|