combo boxes...please help w/2nd choice. thank you

P

potter

What if I want to skip the 1st combo box and make my first selection in the
2nd, 3rd, etc. combo boxes. How can I select a value in the 2nd combo box
before making a choice in 1st combo box? Do I always need to follow the
order of combo boxes to keep all the combo boxes synchronized?

For example: I want to find a customer that I know is located in Chicago.
Therefore, I prefer to select "Chicago" from cboCity before cboCountry,
cboRegion, cboState, cboCounty. After I select "Chicago" is it possible the
other combo boxes populate with the following results?

cboCountry "USA"
cboRegion "Central"
cboState "IL"
cboCounty "Cook"

Furthermore, what if I conclude that the customer is not actually located in
Chicago but is in a near suburb? Is it possible to select "Cook" from
cboCounty and then cboCity repopulates?

I'm a new user...I hope this gives you a good idea of what I am trying to
accomplish.

Thx, potter
 
M

Michel Walsh

Hi,


You are not obliged, but Chicago cannot be on East Coast, so if you start by
first selecting, say, the second combo, the first combo would, at best, be
updated by relevant info, or, at most, left empty. A possible trick is to
write the SQL statement that makes the list of the combo box accordingly,
in, say, in the got focus event of combo2:



Dim str As String
str="SELECT whatever FROM somewhere WHERE true "
If 0 <> len(Combo1 & vbNullStringl) then
str= str & " AND country= FORMS!formNameHere!Combo1"
end If


if str <> combo2.RowSource then
combo2.RowSource=str
End If



Note that we first tested to see if Combo1 is null (or empty string) and if
so, the list of combo2 will display every thing, else, and only then, it
will be limited.


Hoping it may help,
Vanderghast, Access MVP
 

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