pass parameter value to query

  • Follow


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?
0
Reply Utf 12/29/2007 4:02:04 PM

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:

www.mvps.org/access/forms/frm0031.htm



"harleyken" wrote:

> 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?
0
Reply Utf 12/29/2007 6:00:00 PM


1 Replies
515 Views

(page loaded in 0.472 seconds)


Reply: