Prevent duplication in a field

K

Ken

Hi
(Access 2003) Is there any way to check that the data typed into a field
(e.g. 201-150-500) is not duplicated as I leave the field, not after
exitinng after all of the form is filled in as happens now
Regards
Ken
 
S

Steve McLeod

Use the control's before update event to check your values. If you want to
stop the update then:
MsgBox the user
optionally Me.controlname.undo
Cancel=True
Me.controlname.setfocus
 
K

Ken

Hi
All I was after was a simple message to say, already exists
I am not sure how to write VBA code, although I am familiar with properties
and where to look at the variuos VBA codes for each field in a form.
Regards
Ken
 
Top