Hi,
As in the title: the main goal is to create a report for each subject and save it as PDF.
this code do the job.
But I would like to have a distinct query to find all subjects' ids, then store its values as "subcol" array instead of writing it manually.
I appreciate your help.
As in the title: the main goal is to create a report for each subject and save it as PDF.
this code do the job.
Code:
Private Sub Command15_Click()
Dim sql As String
subcol = Array(14, 16, 30, 74, 289, 200548, 201103, 200594, 200569, 402031, 201105, 157)
For i = 0 To 11
sql = "SELECT * FROM Y7M WHERE(((Y7M.[Student Id]) Is Not Null) AND ((Y7M.[Subject Id])=" & subcol(i) & "))"
'Debug.Print sql
Me.RecordSource = sql
DoCmd.OutputTo acOutputReport, "Query1", acFormatPDF, "C:\Desktop\Year 7 " & Me.Subject & ".pdf"
Next i
End Sub
I appreciate your help.