can i link/ nest combo boxes

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi, is it possible to select from one combo box so that it filters the
available selections in a second combo box. I then need to run a report (I
have got the code for that) then probably start all over again.
Currently my first combo box, selects the week number and my second combo
box selects all the trade groups
Id love to be able to select the truly available trade groups instead of
everyone in the query

Hope that made some sense
 
Open the properties sheet for your second combo box. In the row source click
on the elipse and go to the design view of the query. Add another column that
contains the same field that is the source of your first combo box if it's
not already there (you can make it hidden if you want). In the criteria row
for this new field put the following;

Forms![name of your form]![name of your first combo box]

This should filter the selections based on whatever is selected in your
first combo box.

Also, you'll need to add code in the after update event of your first combo
box to requery the second box after a new value is selected.

Me.[name of your second combo box].Requery

HTH
 
A commonly used technique. This is known as Cascading Combos.

Set the second combo up so that in filters on the first.
SELECT TradeGroup FROM tblTrades WHERE WeekNo = Me.cboWeekNo

Then in the After Update event of the Week combo, requery the TradeGroup
combo. (No additional fields are necessary in the second combo)
 
Thanks to both fo you thats got me one step closer. I now have a problem with
the after update requery, it asks for a macro Me.

My first combo box is called Cmbweek1 and has this in the Row source
SELECT [Defect Horizon Combo Week List].[Weekly Horizon] FROM [Defect
Horizon Combo Week List] ORDER BY [Weekly Horizon];

My second combo box is called Cmbtrade1 and has this in the Row source
SELECT [Defect Horizon NC Who Resp List].[Nc Who Resp] FROM [Defect Horizon
NC Who Resp List] WHERE ((([Defect Horizon NC Who Resp List].[Weekly
Horizon])=Forms!test!CMBWeek1));

In the First combo box it has this in the After Update
Me.[Cmbtrade1].requery
 
Back
Top