Cascading Combo Box Problem (1 Viewer)

clf

New member
Local time
Today, 22:19
Joined
Jan 9, 2001
Messages
8
Hi,

I am struggling with a cascading combo box problem. I have a combo box cbo_county - when I select a county from this combo box I would like to have the fields in two other combo boxes (cbo_project and cbo_map_file)
updated with fields only from the selected county.

The cbo_project combo box is based on a table (Projects) with the following fields: project_ID, project_name, county.

The cbo_map_file combo box is based on a table (Map File) with the following fields: Map File, County

I have no problem making it work with just one of the combo boxes, just like a regular cascading combo box, my trouble is getting both combo boxes to update at the same time. How can I accomplish this?

Currently, in order to have it work with one combo box I have it set up with the following code on the After Update event of the cbo_county combo box:

Private Sub cbo_county_AfterUpdate()

cbo_project.RowSource = "Select Projects.project_name " & _
"FROM Projects " & _
"WHERE Projects.County = '" & cbo_county.Value & "' " & _
"ORDER BY Projects.project_name;"

End Sub

Thanks in advance for any suggestions!
 

mljm

New member
Local time
Today, 22:19
Joined
Feb 2, 2013
Messages
1
Hi,

This is an old thread, and i am new here, but the question I have is very much related, so maybe someone here has an answer, as trawling the internet has not solved it.
Using Access2007 and VB to populate cascading combo-boxes.
By selecting an option in one box, I want to fill the second box with particular values, such as the country example: select a country and get a list of places in that country. My example is for electronics, but the same idea.

My sql statement works, in SQL viewer.
But, when I try to populate myTable.RowSource, what I see in my dropdown is not the values, but the actual SQL statement. It is not executing.
VB tells me that RowSource is a string.
I don't understand the mechanism how it executes the SQL inside the string.
I tried adding the command 'myTable.requery' but to no effect.

The only thing that seems to work is the event itself, or it would not have populated RowSource.
 

Users who are viewing this thread

Top Bottom