Combo Box Auto Select (1 Viewer)

deehutchins

Registered User.
Local time
Today, 06:13
Joined
May 30, 2014
Messages
49
Good afternoon,

I using access 2010 and I am trying to code (VBA) one of my combo box to auto select if another combo box consist of multiple selections. So for example I have a multi select combo box that has a list of departments and based on what the user selects I want the other combo box to automatically select itself if one or more of the department in the first combo box is selected:

Departments
A
B
C
D
E

Combo Box 2
Clinical (Auto Select)


Any Ideas? Thanks in advance,
 

spikepl

Eledittingent Beliped
Local time
Today, 15:13
Joined
Nov 3, 2010
Messages
6,142
Good morning. (This is AWF, so the sun never sets here!)

In the AfterUpdate event of the first combo put code to select whichever item of the second.
 

deehutchins

Registered User.
Local time
Today, 06:13
Joined
May 30, 2014
Messages
49
Okay thanks, but what kind of code would I write in the after update to get the second combo to auto select?

Thanks again.
 

vbaInet

AWF VIP
Local time
Today, 14:13
Joined
Jan 22, 2010
Messages
26,374
You're talking about a multi-select listbox not a multi-select combo box. And what you want to look into in the first instance is "cascading combo boxes". There are plenty of examples of that on here.

After you get that working we'll look into updating the code to integrate the multiple selections.

But in your next post, please show real examples for both combo boxes.
 

deehutchins

Registered User.
Local time
Today, 06:13
Joined
May 30, 2014
Messages
49
I think I may have confused the situation, I am just looking to auto select one combo box based on the other combo box selection. Please see attachment below for more detail. I am trying to get the second image to auto select itself no matter what the user selects from the first image.
As you can see the second image only has one option from the combo box and the first image has multiple. I would like the user to select how ever many options they want from the first image combo box just as long as the second image combo box is auto selected as a result.

Due to the fact that the second combo box only has one option to choose from I do not think cascading the combo box would help.

Thanks anyway.

Do you have any other ideas.
 

Attachments

  • Combo Box 1.jpg
    Combo Box 1.jpg
    100.9 KB · Views: 140

vbaInet

AWF VIP
Local time
Today, 14:13
Joined
Jan 22, 2010
Messages
26,374
Multi-valued fields are frowned upon because they aren't relational. There's just no easy way to that, it will involve a significant amount of code with two recordsets. If you want to carry on using multi-value fields then you can look into Recordset2.
 

Users who are viewing this thread

Top Bottom