Duplicates Entries

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

Guest

I am trying to create a simple invoice entry form. And I need help creating
a code that would prevent a user from entering a duplicate number for each
vendor entered.
I noticed that If I prevented duplicates numbers at the table level it would
work, however it would prevent duplicate numbers for all vendors.....which
would not work. I have only four fields, me.vendorname, me.vendorno,
me.invdate, me.invamount; the table is called "entry". Any help is
appreciated, thanks.
 
It sounds like you want a composite key: vendorname and vendorno
So instead of keying on vendorno only, create a unique key based on
vendorname and vendorno. Open the table in design mode. Click the Indexes
button (lightning bolt). Clear all old indexes and create a new one called
MyKey (or whatever). Choose the fields vendorname and vendorno. Make the
index unique. If you need other indexes, add them with a different name but
don't make them unique.
 
Kingston, worked like a charm!! Thanks!

kingston via AccessMonster.com said:
It sounds like you want a composite key: vendorname and vendorno
So instead of keying on vendorno only, create a unique key based on
vendorname and vendorno. Open the table in design mode. Click the Indexes
button (lightning bolt). Clear all old indexes and create a new one called
MyKey (or whatever). Choose the fields vendorname and vendorno. Make the
index unique. If you need other indexes, add them with a different name but
don't make them unique.
 
Back
Top