I seem to be missing the point of your difficulty.
And I do remember how difficult it was when I first started with cascading
combos and list boxes.
I will try to give an example.
Suppose you were trying to sort out countries, states and cities (please
ignore the fact of cities with the same name in different states for this
example).
The first combo would allow user to select a country.
The 2nd combo only shows the cities that are in the country selected in the
1st combo.
The 2nd combo would see the value of the ID of the Country from the 1st
combo.
The 2nd combo would use a where clause something like:
"Where [CountryID] = " & Me.Combo1& ""
in the query that makes the row source for the 2nd combo.
On to the 3rd combo.
The 3rd combo looks at the 2nd combo to see which value for city was chosen.
The 3rd combo has a where clause something like:
"Where [CityID] = " & Me.Combo2 & ""
in the query that makes the row source for the 3rd combo.
Jeanette Cunningham MS Access MVP -- Melbourne Victoria Australia
prog said:
I guess my question is then, How do I define the row source for the 3rd
list
box based on the values of the second box (which are based on the first)?
Should I use syntax like the following for the row source in the third
listbox: Me.[listbox2].Requery ??
Jeanette Cunningham said:
It is the same process whether 2, 3, 4 or more cascading combos or list
boxes.
The 3rd list box has its row source filtered by the item selected in the
2nd
list box.
Jeanette Cunningham MS Access MVP -- Melbourne Victoria Australia
Ok. I was able to get that to work. Now I'm running into some issues
when I
try to create a third listbox which returns results based on the second
one.
:
Hi prog,
this is similar to creating cascading combo boxes.
Use the after update event of the listbox with questions, to build the
row
source for the listbox with answers.
A simple example would be something like this:
Dim strSQL as String
strSQL = "Select AnswerID, AnswerDescr " _
& "From tblAnswer " _
& "Where QuestionID = " & Me.[NameOfQuestionListbox] & " " _
& "Order by AnswerDescr"
Me.[NameOfAnswerListbox].Rowsource = strSQL
Jeanette Cunningham MS Access MVP -- Melbourne Victoria Australia
Hi,
I have two tables. One has a list of questions and the other table
lists
answers to those questions. It's a one to many (one question many
answers).
What I'm trying to do is have a list box list all the questions,
which
I
already have and then based on the question I pick (onclick) a
second
listbox
appears showing me specific answers to that question. And I already
have
this created via joins between the two tables in the background.
Thanks