Multiple Rowsource (1 Viewer)

qazxsw123

New member
Local time
Yesterday, 23:53
Joined
Dec 18, 2018
Messages
2
Hello,

I am working on a form for work. I have a table/query rowsource and before that I have a chemical type to choose from. After choosing a chemical type the other combobox automatically populates its corresponding type but, I also need it to provide a list of other choices from a combobox. Ex. someone chooses a chemical type and the other combobox now has a '3' as the corresponding type. I then also need the second combobox to offer other types from a dropdown list (ex. also have 0,1, and 2) as other possibilities.

In other words:

I have a list of chemical types and each chemical type has a number (1,2, or 3) associated with it. When someone chooses the chemical type in the combobox, the other combobox automatically updates with the number being displayed. What I want to have happen is keep that function as is but, also give the user the ability to choose another number if they want to. Ex. you choose chemical a from the combobox, the other combobox then returns the value of 1 but, that is the only number being displayed in the other combobox. What I want is to give the user the ability to change the number with values of either 0,1,2, or 3.

Any assistance is appreciated!
 

Ranman256

Well-known member
Local time
Yesterday, 23:53
Joined
Apr 9, 2015
Messages
4,337
I have a table with a list user choice and a query that pulls that data. say:
1, qsAnimals
2, qsPlants
3, qsPlanets

then after update event will assign THAT query to the next combo box
Code:
sub cboBox1_Afterupdate()
cboBox2.recordsource = cboBox1.column(1)  'in vb columns begin with zero
end sub
is this what youre looking for?
 

The_Doc_Man

Immoderate Moderator
Staff member
Local time
Yesterday, 22:53
Joined
Feb 28, 2001
Messages
27,313
It is possible that you are talking about something we call "Cascading Combo Boxes" which has been explored in this forum quite often.

In the thin ribbon near the top of the form, the SEARCH function is 3rd from the right and can be used to find literally dozens if not hundreds of articles on the methods required to implement several variants of what you described.

In order to keep from re-inventing this wheel, I respectfully recommend that you try the search I suggested. Often, you can find things yourself and read at your leisure if you just know the right question. And for this, the right question is "Cascading Combo Boxes."
 

qazxsw123

New member
Local time
Yesterday, 23:53
Joined
Dec 18, 2018
Messages
2
I already have the two different comboboxes connected. I also added "Me.Combo174 = Me.Combo174.ItemData(0)" to the first combobox to automatically display the associated number type to the selected chemical type. What I am trying to do is after all of that is completed, give the user the ability to change the number type incase they do not want the automatically generated number type. I have been working on the form and I am able to get the number type automatically associated with the ItemData function and using a table/query rowsource type and I am also able to get the number type dropdown when using a value list rowsource type but, I am unable to get them do work at the same time as only one of the two will work.
 

Users who are viewing this thread

Top Bottom