NOT Cascaded - Bring up data via either (NOT both) of 2 combo boxes

st3ve

Registered User.
Local time
Today, 16:50
Joined
Jan 22, 2002
Messages
75
OK the first part i can do (ie Bring up data via either combo box)..
For example i want to be able to select a person by their name or by their code number.
I am using recordsetclone statement to pull up the data at present....

But how do I get the second combo box to display the 'matching' data when a value from combo box 1 has been selected, and also vice versa.

ie. When I select "Joe Bloggs", I want to see "Joe Bloggs's" code number correctly shown in the code number (second) combo box.

The contents of the non-selecting combo box 'window' seems to loose synch somehow.

Your ideas all welcome.

Thanks.
 
Last edited:
st3ve,

not knowing the full details of your form, I would suggest:

- The use of a combo for finding a record (as constructed by the combo wizard) would indicate that the combo is not "bound" to the record.

- Thus combo1 is unaware of what combo2 and the record itself is doing (and vice versa).

- If you select records from alternate combo's the data presentation appears incorrect as you mentioned.

Fix:

You could add the following code to the After_Update event of the combos:

Add to combo1
Code:
me.combo2 = me.combo1

- Reverse for combo2

You will need to ensure that column(0) (first) column for each combo is refering to the same info (preferably PK). Remember column(0) can be hidden for the purpose of the combo display.

HTH

Brad.
 
Sample attached

Brad, Thanks for the suggestion. I see where you're going with that. Its not quite what i want.

When I search using using first combo, I retrieve all the data in the form, but I also want the second combo box to show the matching data in the box window. At present, it remains static (contains the data selected in any previous search using that box).

I have attached my db as db11.zip.

If you choose a practice code then all looks OK. And now if you choose an admin code to search by it still appears to be OK... but look at what is in the practice selection window... the previously searched for value! It's this window in which I want to show the matching data to the admin code.

If you/anyone have time to check this out I would appreciate it. Its driving me nuts.
 

Attachments

St3ev,

The method I suggested will solve your problem.

Having looked at your demo, you will need to alter the structure of your second combo box. As previously stated:

You will need to ensure that column(0) (first) column for each combo is refering to the same info (preferably PK). Remember column(0) can be hidden for the purpose of the combo display.

I have altered your demo to suit. Take particular notice of the new structure of the second combo box.

Add the "combo1 = combo2" to the code, and all is fine and dandy.

Have fun

Brad.
 

Attachments

Bang on the button..

Yep. It sure did, thanks very much. Apologies for my failure to follow your excellent instructions, the first time! :o

Many thanks, again, Brad.

PS.

VB maestro drinks VB Bitter? Surely no coincidence. Perhaps I ought to try some!
 

Users who are viewing this thread

Back
Top Bottom