pass parameter value to query



Thanks for taking the time to read/help!

Students table: has field for assigned class (numeric value from sheduled
classes table)

Students form: data for student, with a continous subform [assign to
scheduled classes] which displays available class dates for class, selected
from combo box on main form. students can be assigned to available classes
via command button.

on [assign to scheduled classes] is a field [class number]

problem: I would like to count number of students already assigned to a
particular class (ie: 1, 2, 3, etc) and display this next to class number to
see when a class is getting full..

so far -- I have an unbound text box on subform using
=DLookUp("Enrolled","Query1") as the control source..

Query1 SQL:

SELECT Count(Students.[Class Number]) AS Enrolled
FROM Students
HAVING (((Count(Students.[Class Number]))=[Forms]![assign to sheduled
classes]![class number]));

When I open the form, a error message appears in the unbound text box
(flashing repeatedly) This error doesn't go away when a class is selected
from the combo box..

is this the right approach?


SELECT Count(Students.[Class Number]) AS Enrolled
FROM Students
WHERE (((Students.[Class Number])=[Forms]![students]![assign to sheduled
classes].[form]![class number])));

worked good... found a great resource for referring to forms and controls at:

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question