how do i use one combo box to determine the content of a second combo box?

Z

zawanda

Hello,

I have been trying for several days to figure out how to use one combo
box to determine the content of a second combo box.

I am creating a database listing equipment by manufacturer and model #

I would like to create one combo box that gives a drop down list of
manufacturers

Then, based on the manufacturer chosen, I would like to have a second
combo box which gives a drop down list of model #'s offered by the
chosen manufacturer

It seems like a fairly simple concept, but I have poured through the
"using access 2003" guide with no luck

Access version I'm using: 2003
 
T

tina

well, you don't tell us anything at all about your table(s) design, so i'm
assuming you have the equivalent of the following, as

tblManufacturers
ManID (primary key)
ManName (text)

tblModels
ModelID (primary key)
ManID (foreign key from tblManufacturers)
ModelNumber

next, i assume the first combobox control on the form uses tblManufacturers
as the RowSource, and i'll call it cboManuf. and the second combobox uses
tblModels as the RowSource, and i'll call it cboModel. in form Design view,
select cboModel and in the Properties box click on the RowSource property
"line", then click the Build (...) button at the right side. that opens a
window that looks like a query Design view. add the ModelID and ModelNumber
fields to the grid. then add ManID to the grid, uncheck the checkmark box in
that column, and add criteria, as

Forms!FormName!cboManuf

replace FormName with the correct name of the form, of course. close and
save; now the RowSource for cboModel is a SQL statement, not a table name.
click on cboManuf and add the following code to its' AfterUpdate event
procedure, as

Me!cboModel.Requery

use the above example as a guide to setting up your own cascading
comboboxes.

hth
 
Z

zawanda

Thank you Tina!! You Rock! I got it to work!

well, you don't tell us anything at all about your table(s) design, so i'm
assuming you have the equivalent of the following, as

tblManufacturers
ManID (primary key)
ManName (text)

tblModels
ModelID (primary key)
ManID (foreign key from tblManufacturers)
ModelNumber

next, i assume the first combobox control on the form uses tblManufacturers
as the RowSource, and i'll call it cboManuf. and the second combobox uses
tblModels as the RowSource, and i'll call it cboModel. in form Design view,
select cboModel and in the Properties box click on the RowSource property
"line", then click the Build (...) button at the right side. that opens a
window that looks like a query Design view. add the ModelID and ModelNumber
fields to the grid. then add ManID to the grid, uncheck the checkmark box in
that column, and add criteria, as

Forms!FormName!cboManuf

replace FormName with the correct name of the form, of course. close and
save; now the RowSource for cboModel is a SQL statement, not a table name.
click on cboManuf and add the following code to its' AfterUpdate event
procedure, as

Me!cboModel.Requery

use the above example as a guide to setting up your own cascading
comboboxes.

hth
 

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