Background: I have a database I am in the process of making for the school board. I am in the final stages and have never had a loop that I couldn't figure out...except for this one.
Setup: Here is the SQL on the query that runs the report "rpt_SeatingChart_AMFirst"
SELECT tbl_Students.SchoolName, tbl_Students.StudentCalculated, tbl_Stops.[Stop Location], tbl_Stops.[Stop Time], tbl_Students.AssignSeat, tbl_Students.DateOB, tbl_Students.Address, tbl_Students.Zip, tbl_Students.Phone1, tbl_Students.Phone2, tbl_Students.Grade, tbl_Students.PhysicalLimitations, tbl_Students.ParentReq, tbl_Schools.[School Name], tbl_Students.ActiveRider
FROM tbl_Schools INNER JOIN (tbl_Stops INNER JOIN tbl_Students ON tbl_Stops.ID = tbl_Students.[Stop LocationAM]) ON (tbl_Schools.ID = tbl_Stops.School) AND (tbl_Schools.ID = tbl_Students.SchoolName)
WHERE (((tbl_Schools.[School Name])=[Forms]![frm_SchoolPickerAM]![Combo113]) AND ((tbl_Students.ActiveRider)="Active"));
The form that it is asking for the input from, is what school the report should display. So if I pick School1 from combo113, the report would show only students assigned to that school. I have a table with schools in it found here: [tbl_Schools]![SchoolName].
Execution: On the click event of a button, I would like to have [rpt_SeatingChart_AMFirst] open with the first [School Name] from the [tbl_Schools] table. Export that report as a PDF, close and reopen as the second [School Name] int he table. Export and repeat until all the schools opened in that report from the table.
Edit your code as follows: