Hi J,
You will need to open the report filtered for each school, then print to
PDF, in order to have 100 separate PDF files. You can do this with VBA code
using a loop, but without knowing the name of your report, or the table and
fieldnames involved for storing the school info, I cannot provide a specific
example. Here is a procedure that should get you there part way. It assumes
that your default printer is set to a .PDF printer driver (otherwise, you can
specify this, under File > Page Setup on the Page tab.
Create a query named qrySchools that includes a listing of the desired
schools. Use the appropriate criteria to produce a filtered list, if you do
not wish to include all schools. The query needs to include the primary key
of the school, shown in this example as "pkSchoolID". This example also
assumes a numeric primary key field. You'll need to make a slight
modification in the event that your primary key is a text data type. Finally,
this code requires a checked reference to the Microsoft DAO 3.6 Object
Library.
Sub Test()
On Error GoTo ProcError
Dim db As DAO.Database
Dim rs As DAO.Recordset
Set db = CurrentDb()
Set rs = db.OpenRecordset("qrySchools", dbOpenSnapshot)
With rs
Do Until (.EOF Or .BOF) = True
DoCmd.OpenReport "YourReportName", View:=acViewNormal, _
WhereCondition:="pkSchoolID = " & rs("pkSchoolID")
rs.MoveNext
Loop
End With
ExitProc:
'Cleanup
On Error Resume Next
rs.Close: Set rs = Nothing
db.Close: Set db = Nothing
Exit Sub
ProcError:
MsgBox "Error " & Err.Number & ": " & Err.Description, _
vbCritical, "Error in Test subroutine..."
Resume ExitProc
End Sub
After copying and pasting the code, and making the appropriate substitutions
for the name of the report, the name of the query and/or the name of the
primary key field, click on Debug > Compile ProjectName. Hopefully, your code
will compile without an error.
Tom Wickerath
Microsoft Access MVP
http://www.access.qbuilt.com/html/expert_contributors.html
http://www.access.qbuilt.com/html/search.html
__________________________________________