Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to avoid duplicates in a multiple-choice drop-down

Status
Not open for further replies.

groul

Technical User
Jan 18, 2003
24
LU
My database consisting of 3 forms. A mainform, a subform and the subform containing another subform.
The sub-subform is sort of a drop-down list with multiple choices. In other words, the main form provides information(s) whis is/are applicable to multiple information(s) to the subform. One main record may contain more then one record in the subform.
Each record in the subform must show effectivity/effectivities (which provides the sub-subform).
E.g. the main record containing 3 subrecords and each subrecord shows 3 effectivities.
I may choose the effectivity in each subrecord by selection. Unfortunately, one may select the same effectivity in the same subrecord twice or three times etc.
Now the question, what may I do to avoid selection of the same information in one subrecord.
E.g. in the first subrecord I choose as the effectivity "John" and "Jim" and "Linda". But incidentally I have chosen "John" twice in the same subrecord. An error message should appear to tell me that a dublicate exist already. Has anyone a solution to it? Would be great. Thank you very much.
 
Hi,

I would use an array (vba) to do this.

Store each selection PK in the array - checking against current contents in the array for duplicity before adding to the array.
Where it already exists - you show user error msg.

You need to 'dim' the array before use as to size, and would do this by counting records in list before-hand.

Your description is't too clear (to me) so I can't go into detail - might be wasting my time.

But - arrays would be my solution. Look at 'array' in help (VBA).

Kind regards,

Darrylle "Never argue with an idiot, he'll bring you down to his level - then beat you with experience." darrylles@totalise.co.uk
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top