Code to temporarily change "no duplicates allowed" property

L

lindavon81

My database is used to track circuit board shipments. The serial no. field is
set to "No Duplicates Allowed", as a way to ensure that our serial numbers
aren't duplicated for any one customer.
The problem is that we get returned circuit boards that have to go through
the same shipping process, causing the serial number to have to be re-entered
into the database. I need to be able to write a code that if the serial
number belongs to a returned product, (determined by a yes/no checkbox),
duplicates are allowed.
I figure an "If ... Then" statement would work, but I can't seem to find the
correct words to get it written right. Is there anyone that can help me? I'd
greatly appreciate it!
 
D

Douglas J. Steele

No offence, but it sounds as though something's wrong with your design if
you need to do that.
 
L

lindavon81

I agree, this is a database that was designed by someone else, with many
tables, forms, reports and queries. The forms are loaded with command buttons
that didn't work; subforms that are then used to generate a shipping report.
I have been able to fix all of them, except for the returned product serial
number problem. Unfortunately, I have had to repair the database instead of
being able to create something from scratch.
I'm thinking that to solve it, I need to create a separate form all
together, or put an "r" in front of the serial number to avoid a dupliate
serial number. The problem I'm really having is that the original database
was able to accomplish this, and I can't figure out how. I have checked all
of the event procedures, macros (there are many of them as well), and can't
see how this was accomplished.
I appreciate that you responded!
 
U

UpRider

How about this? Remove the 'no duplicates' requirement.
When the user enters the serial number, have the before update event of that
textbox control do a Dlookup and see if the serial number already exists. If
so, use a msgbox to verify that it is OK.
If not OK, CANCEL. If OK, proceed.

UpRider
 

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