Avoid duplication

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi,

I have a data base called orders,
table name=Orders
Form name(it's based on above table) = ordentry
one text box is for Order number
I'm looking for to avoid duplication, if the order number exist, then a
message should show to user "the number exist" in after update event of the
text box. My order number is a combination of numbers and text (
eg:POrd/251/04)
 
Rene,

Go to design view of the table that contains your order number field. Select
the field. Go to the General tab at the bottom and change the Indexed
property to Yes, No Duplicates. Access will automatically warn you if you
enter a duplicate order number.
 
i want the user to know right after the entry of the order number, if we indx
it, there will be a message but it doesn't show in which field. I have 7 in
put fields in my forms. can we do something in Afterupdate event... please
help
 
You want to use the BeforeUpdate event not AfterUpdate event. Use this code:
If DCount("[OrderNum]","Orders","[OrderNum] = '"Forms!OrdEntry!OrderNum &
"'") <> 0 Then
....Duplicate
Cancel = True
End If
 
Back
Top