Using the value selected from a ComboBox

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

Guest

I have a subform (Training Sub Form), displayed as a Datasheet. This is used
by a main form (Employee Main). The first field on this subform is a Combo
Box (Job), from which the user selects a Job name. The second field is
another Combo Box (Group), from which the user selects a work area. the
values for both boxes come from tables.

I'm trying to work out how to limit the items displayed in the second box to
only those relevant to whatever was selected in the first.

Presently, the query behind the rowsource for the second box is:
'Select Stations.Group_name from Stations Order by Stations.Group_Name;'.
This works fine.

I've tried altering it to:
'Select Stations.Group_name from Stations Where Stations.Job =
Forms![Employee Main]![Training Sub Form]![Job] Order by Stations.Group_Name;'
but I get a message saying 'Training Sub Form' can't be found.
The same happens if I try:
'Select Stations.Group_name from Stations Where Stations.Job =
Forms![Training Sub Form]![Job];'
or
'Select Stations.Group_name from Stations Where Stations.Job = [Job];'
or
'Select Stations.Group_name from Stations Where Stations.Job = Me![Job];'

Any suggestions how I should phrase the query, in order that it correctly
picks up the value from the first box?
 
Your first alteration looks right but try putting brackets around Forms in
the second line --
'Select Stations.Group_name from Stations Where Stations.Job =
[Forms]![Employee Main]![Training Sub Form]![Job] Order by
Stations.Group_Name;'

Are you refreshing the query after selecting JOB?
 
Back
Top