|
|
limit Options in a combobox
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.
--
Message posted via AccessMonster.com
http://www.accessmonster.com/Uwe/Forums.aspx/access/200802/1
|
|
0
|
|
|
|
Reply
|
faureman
|
2/20/2008 8:58:58 PM |
|
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
--
Steve Schapel, Microsoft Access MVP
faureman via AccessMonster.com wrote:
> 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.
>
|
|
0
|
|
|
|
Reply
|
Steve
|
2/21/2008 12:09:15 AM
|
|
|
1 Replies
297 Views
(page loaded in 0.031 seconds)
|
|
|
|
|
|
|
|
|