limit Options in a combobox

  • Thread starter Thread starter faureman via AccessMonster.com
  • Start date Start date
F

faureman via AccessMonster.com

I have an event form (frmEvent) that references a table of the same name
(tblEvent). In this event form, I have a combobox (cboProgramName) that lists
every program. Below it, I have a combobox (cboPartNo) that lists all the
parts. I would like the selected program in the 1st combobox drive the part
numbers that show up in the 2nd combobox.

Now, I have a Part Number Table (tblPartNo) that has the foreign key to a
Program table (tblProgram). I want to use the ProgramID to drive the options
in the Part Number combobox in the frmEvent. In other words, when the user
pickes Program "X" from the dropdown list, I want to populate the Part
numbers tied to Program "X" to be in the cboPartNo combobox. As I said, this
ProgramID key is already in the tblPartNo but I don't know how to associate
the two comboboxes together.

Can I use the "Control Source" and "Row Source" controls to make all parts
tied to the selected program cboProgramName show up in the cboPartNo? Or, is
there another easy way to make this subset of parts show up?

Thanks.
 
Faureman,

Use a Query, based on the tblPartNo table, as the Row Source of the
cboPartNo combobox. In the Criteria of that query, reference the
Program from the form, using syntax such as:
[Forms]![frmEvent]![cboProgramName]

To make it reliable, you need to put code on the After Update event of
the cboProgramName combobox, like this:
Me.cboPartNo.Requery
 
Back
Top