Prevent Duplicate Values

Jerry Jones

New member
Local time
Today, 14:54
Joined
Aug 24, 2001
Messages
7
Good Morning,

I am attempting to prevent a duplicate value being entered in my Status-Code subform.

There are 5 possible choices from a combo box named StatusCode.

I would like either a msgbox announcing that it is a duplicate value or a cancel event to disallow the selection.

Can you please help me with some suggestions on how to handle this problem and possibly some code.

Thank You

JerryJ
 
Please elucidate. Do you mean that if selection A was used for the first record, that you don't want the user to select A for the second record?
 
I think your on the right track but here is some more detail.

The form starts with so information about the movement of a truck and it's cargo.
We then move into this Status-Code Subform to record it's status ie:

X3 stands for truck arrival for pickup
CP stands for pickup complete
X1 stands for arrival for delivery
D1 stands for delivery complete
X6 stands for delivery in route

we choose for this list using a combo box.

The name of the control is combo32.

Our goal is to protect against duplicate entries. ie: two of any of the above code per delivery.

I hope this helps and thank you for your prompt response.

JerryJ
 
Jerry,

Try this. Create a select query that links the table containing the trucks' itinerary data to the table that contains all the possibilities for the combobox. Modify the link so that you so that the resultset of the query includes only the options that have not already been stored in the table for that truck. Use this query as the rowsourse of the combobox. This way the list never gives options that would cause a duplicate. It is also more efficient for the user.

I have done things like this in the past and this technique works very well. You know better than I the details of what you are trying to do. So with that in mind find a way to limit the selections of the combobox.

Good luck!

Mike
 
Hi Mike,

I have tryed your suggestion a few different ways but still no success.

Could I send you a copy of the database for you to look at or could you send me a copy of your previous project.

Thanks again for your continued support.

Jerry
 
Jerry,

Why don't you send me a copy of your database.

mangel@angel-star.com

Mike
 

Users who are viewing this thread

Back
Top Bottom