Use combo box selection to call info to another combo box

J

James

Hi.

I have created an access form that has a combo box allowing a selection of 8 different cities. I also have 8 additional combo boxes that allow selection of a specific road from each of these cities.

I would like to use the city selection combo box to call the roads for the selected city, rather than having a separate combo box for each one. So far, I have been unable to do so. It seems like an easy thing to do, but I am not too experienced with Access.

Thank you for any help.

James
 
G

Gerald Stanley

The ususal method of restricting the items displayed in a
combo box depending upon the item selected in another is to
build the RowSource SQL in the first combo's AfterUpdate
event handler. Assuming that your first combo is cmbCity
and the second is cmbRoad, the code in cmbCity_AfterUpdate
would look something like

cmbRoad.RowSource = "SELECT roadColumn FROM YourTable WHERE
city = '" & cmbCity.Value & "'";

You will have to change roadColumn and YourTable in the SQL
to suit your application.

Hope This Helps
Gerald Stanley MCSD
-----Original Message-----
Hi.

I have created an access form that has a combo box
allowing a selection of 8 different cities. I also have 8
additional combo boxes that allow selection of a specific
road from each of these cities.
I would like to use the city selection combo box to call
the roads for the selected city, rather than having a
separate combo box for each one. So far, I have been
unable to do so. It seems like an easy thing to do, but I
am not too experienced with Access.
 

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