C
Carla Gilless
I've created a employee training database and am having trouble with the user
supplied parameter query. A couple of issues: I have an unbound form
(AdHoc) for user to select parameters to pass to the underlying query to open
report. The form, query, report open correctly, but only 2 of the supplied
parameters return data. (BegDat and End/Date work as does ClassName.
ClassName is a combo box on the unbound form tied to a simple query of
ClassName.) Sql code is below, but first a couple of questions.
1) Loc and BU don't supply data. Is something off in the code below?
2) I want Loc and BU to be combo boxes, however since multiple instances of
both can be from one class, how do I restrict the dropdown list to only one?
In other words, 5 students from loc SF are in the class I've chosen, so the
dropdown list for LOC shows 5 SF's. I want only 1 SF to show up. Is this
possible and how do I code the combo box? Same issue with BU--multiple
students from FIN may attend the class, but I want the combo box to only show
1 FIN.
3) I have 3 checkboxes in the database from tblStudents and Classes that
are lookups to tblResults--Enrolled, Attended and Cancelled. I would like
these to be choices on the unbound form too. How do I code for a checkbox on
the form so that if it is true (or yes value), the report will then find only
those students who enrolled or attended or cancelled for a particular class?
Any help would be greatly appreciated. Thanks.
SELECT Classes.Date, Classes.ClassName, Classes.Time, [Students And
Classes].EmplID, Students.Loc, [Students And Classes].EmplID, [Students And
Classes].Enrolled, [Students And Classes].Attended, [Students And
Classes].Cancellation, Students.BU
FROM Students INNER JOIN (Classes INNER JOIN [Students And Classes] ON
Classes.ClassID = [Students And Classes].ClassID) ON Students.EmplID =
[Students And Classes].EmplID
WHERE (((Classes.Date) Between [Forms]![AdHoc]![BegDate] And
[Forms]![AdHoc]![EndDate]) AND
((Classes.ClassName)=[Forms]![AdHoc]![ClassName]) AND
((Students.Loc)=[Forms]![AdHoc]![Loc] Or (Students.Loc) Like
[Forms]![AdHoc]![Loc] Is Null) AND ((Students.BU)=[Forms]![AdHoc]![BU] Or
(Students.BU) Like [Forms]![AdHoc]![BU] Is Null)) OR
(((Classes.ClassName)=[Forms]![AdHoc]![ClassName])) OR (((Classes.Date)
Between [Forms]![AdHoc]![BegDate] And [Forms]![AdHoc]![EndDate]));
supplied parameter query. A couple of issues: I have an unbound form
(AdHoc) for user to select parameters to pass to the underlying query to open
report. The form, query, report open correctly, but only 2 of the supplied
parameters return data. (BegDat and End/Date work as does ClassName.
ClassName is a combo box on the unbound form tied to a simple query of
ClassName.) Sql code is below, but first a couple of questions.
1) Loc and BU don't supply data. Is something off in the code below?
2) I want Loc and BU to be combo boxes, however since multiple instances of
both can be from one class, how do I restrict the dropdown list to only one?
In other words, 5 students from loc SF are in the class I've chosen, so the
dropdown list for LOC shows 5 SF's. I want only 1 SF to show up. Is this
possible and how do I code the combo box? Same issue with BU--multiple
students from FIN may attend the class, but I want the combo box to only show
1 FIN.
3) I have 3 checkboxes in the database from tblStudents and Classes that
are lookups to tblResults--Enrolled, Attended and Cancelled. I would like
these to be choices on the unbound form too. How do I code for a checkbox on
the form so that if it is true (or yes value), the report will then find only
those students who enrolled or attended or cancelled for a particular class?
Any help would be greatly appreciated. Thanks.
SELECT Classes.Date, Classes.ClassName, Classes.Time, [Students And
Classes].EmplID, Students.Loc, [Students And Classes].EmplID, [Students And
Classes].Enrolled, [Students And Classes].Attended, [Students And
Classes].Cancellation, Students.BU
FROM Students INNER JOIN (Classes INNER JOIN [Students And Classes] ON
Classes.ClassID = [Students And Classes].ClassID) ON Students.EmplID =
[Students And Classes].EmplID
WHERE (((Classes.Date) Between [Forms]![AdHoc]![BegDate] And
[Forms]![AdHoc]![EndDate]) AND
((Classes.ClassName)=[Forms]![AdHoc]![ClassName]) AND
((Students.Loc)=[Forms]![AdHoc]![Loc] Or (Students.Loc) Like
[Forms]![AdHoc]![Loc] Is Null) AND ((Students.BU)=[Forms]![AdHoc]![BU] Or
(Students.BU) Like [Forms]![AdHoc]![BU] Is Null)) OR
(((Classes.ClassName)=[Forms]![AdHoc]![ClassName])) OR (((Classes.Date)
Between [Forms]![AdHoc]![BegDate] And [Forms]![AdHoc]![EndDate]));