Cascading Combo Box Select All

G

Guest

I found this code that is supposed to give the option to choose all the data
that is available in a cascading combo box.

I.E. Choose State and Get all the Cities.

SELECT table7.city, table7.city FROM Union SELECT "*", "All" from Table7;

I've tried using it but can't get it to work (I'm a new bee).

My questions are:
Where would I put it? (i.e. in AfterUpdate or somewhere else)

Right now I have the following in AfterUpdate

Private Sub cboChange_AfterUpdate()
Me.cboLine = Null
Me.cboLine.Requery
End Sub
 
D

Douglas J. Steele

Either wherever you got that code from had it wrong, or else you copied it
incorrectly. It should be

SELECT table7.city, table7.city FROM Table7 Union SELECT "*", "All" from
Table7

However, all that's going to do is add an additional row to your combo box
saying "All". (and even if you add a SORT BY 2 at the end of that SQL, All
won't necessarily be at the beginning of the list: for example, Adelaide and
Ajax would be be ahead of All, so you might want use "(All)" instead)

In general, how you'd use that for cascading is to reset the RowSource SQL
for the next combo box:

Private Sub cboChange_AfterUpdate()
Me.cboLine.RowSource = _
"SELECT Field1, Field2 FROM Table2 WHERE Field2 LIKE '" & Me.cboChange &
"'"
Me.cboLine.Requery
End Sub

Without more details from you as to exactly what you're trying to do,
though, I can't be any more specific.
 
G

Guest

To explain further,

I have three cascading combo boxes.

The first box that holds the RFQ Number will always display one RFQ Number.

The second box may need to display several Change Numbers.

The third box may need to display several Line Item numbers.

And all data found will need to populate a form/subform for tweaking or
viewing, depending on the situation.

I don't know if this is even possible.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top