Matt Greatorex
Registered User.
- Local time
- Today, 17:48
- Joined
- Jun 22, 2005
- Messages
- 1,019
Firstly, apologies for the lengthy description but I wanted to include all information.
I have two combo boxes on the same sub form (Training Records Sub Form). This form is a sub for my Employee Training Main form.
The first box (Control source and name = Job) is populated by the following query, in the Rowsource field:
SELECT [Stations].[Station_Name]
FROM Stations
WHERE ((([Stations].[Department])=[Forms]![Employee Training
Main]![Department]))
GROUP BY [Stations].[Station_Name]
BY [Stations].[Station_Name];
The second box (Control source and name = Group) is populated by the following query:
SELECT [Stations].[Line]
FROM Stations
GROUP BY [Stations].[Line]
ORDER BY [Stations].[Line];
At present, both work fine.
I’m trying to ensure that only the relevant Line values are available, once the user has selected a Station Name. I’ve tried altering the second query as follows:
SELECT [Stations].[Line]
FROM Stations
WHERE [Stations].[Department] = [Forms]![Training Records Sub Form]![Job]
GROUP BY [Stations].[Line]
ORDER BY [Stations].[Line];
When I test the application, I get prompted to enter a value for [Job]. If I type in exactly what I’ve just selected, from the Job list, the Group list works fine. I get the same message if the WHERE clause is any of the following:
WHERE [Stations].[Department] = [Forms]![Employee Training Main]![Training
Records Sub Form]![Job]
WHERE [Stations].[Department] = Me![Job]
WHERE [Stations].[Department] = [Me]![Job]
If anyone has any ideas, they would be greatly appreciated.
I have two combo boxes on the same sub form (Training Records Sub Form). This form is a sub for my Employee Training Main form.
The first box (Control source and name = Job) is populated by the following query, in the Rowsource field:
SELECT [Stations].[Station_Name]
FROM Stations
WHERE ((([Stations].[Department])=[Forms]![Employee Training
Main]![Department]))
GROUP BY [Stations].[Station_Name]
BY [Stations].[Station_Name];
The second box (Control source and name = Group) is populated by the following query:
SELECT [Stations].[Line]
FROM Stations
GROUP BY [Stations].[Line]
ORDER BY [Stations].[Line];
At present, both work fine.
I’m trying to ensure that only the relevant Line values are available, once the user has selected a Station Name. I’ve tried altering the second query as follows:
SELECT [Stations].[Line]
FROM Stations
WHERE [Stations].[Department] = [Forms]![Training Records Sub Form]![Job]
GROUP BY [Stations].[Line]
ORDER BY [Stations].[Line];
When I test the application, I get prompted to enter a value for [Job]. If I type in exactly what I’ve just selected, from the Job list, the Group list works fine. I get the same message if the WHERE clause is any of the following:
WHERE [Stations].[Department] = [Forms]![Employee Training Main]![Training
Records Sub Form]![Job]
WHERE [Stations].[Department] = Me![Job]
WHERE [Stations].[Department] = [Me]![Job]
If anyone has any ideas, they would be greatly appreciated.