Check for previous entry.

D

DJW

I have a text field on my form that cannot contain a duplicate entry. How
do I check to see if an identical entry has already been made in that field
and then have it pop up a message box if there is an identical entry already
in another record in the same field.

My table name is "tbl_Parts" and the field name in the table is "item".

Thank you.
 
T

tina

open the table in design view, and set the field's Index property to Yes (No
Duplicates). you'll get an error message automatically if you enter a
duplicate value in the field.

hth
 
D

Dan Artuso

Hi,
You could set the field to Indexed (No Duplicates) so that Access will enforce the rule
or you could use DCount to see if the value is aleady in the table.
Something like this:

If DCount("item","tblParts","item = '" & Me.Item & "'") > 0 Then
'already there
End If
 
Top