Duplicates Entries

P

Please help James

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.
 
K

kingston via AccessMonster.com

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.
 
P

Please help James

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top