Re: Message Box Assisstance



Where (from a form, from a data***) and When (upon entry of the data for
Driver No, when the record is saved)?

Assumption:
Entry on a form into a control.

When exiting the control after updating it, you want a message warning the
user that this is a duplicate and cannot be saved.

Private Sub txtDriverNoControlName _AfterUpdate()
IF DCount("*","TblStaff","[Driver no]=" & Chr(34) &
me.txtDriverNoControlName & Chr(34)) > 0 Then
MsgBox "This Driver Number is a duplicate. You may not be able to save
this record",,"Suspected Duplicate"
END IF
End Sub


If Driver No is a number field and not a text field then remove the Chr(34)
from the DCount.


"Greg" <Greg@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:A6E1D5DC-4650-4036-ABA5-3CAB67EDC85F@xxxxxxxxxxxxxxxx
Hi,

I have a field DriverNo in a table called tblStaff.

I have made the property Indexed to be Yes (No Duplicates).

I would like a message to pop up if a user tries to enter a duplicate
DriverNo.

I've never used Message Boxes before.

Thanks

Greg.


.