Good afternoon fellow Access devotees 
I've been trying for a while now to get my code going..Feeling bit like my friend to my right..... :banghead:
Allow me to explain. I have a Report that has a 'Division' as a Header.
A Division can be one of five variables ("CPD","SND","PSD","BPD","PPD")
Ideally want to output the report as a type PDF for each Division. Here, have 5 reports in a folder. I am only getting one. I know that the missing reports is not null. That is they have records.
Here is the code I have cobbled together...
Private Sub Print1_Click()
Dim PathNm As String
Dim RptNm As String
Dim strFileNm As String
Dim Sql As String
Dim db As DAO.Database
Dim rs As DAO.Recordset
On Error GoTo ErrorHandler
strPathNm = "D:\Stock\"
strRptNm = "BCSP Summary Report"
Sql = "SELECT DISTINCT R_Label1 FROM Ring Report"
Set db = CurrentDb()
Set rs = db.OpenRecordset("BCSP Report")
OwnNm = rs!R_label1
strFileNm = strPathNm & "BCSP_Summary" & "_" & OwnNm & ".pdf"
DoCmd.OpenReport strRptNm, acViewPreview, , "R_Label1 = '" & "CPD" & "' "
DoCmd.OutputTo acOutputReport, strRptNm, acFormatPDF, strFileNm
DoCmd.Close acReport, strRptNm
DoCmd.OpenReport strRptNm, acViewPreview, , "R_Label1 = '" & "SND" & "' "
DoCmd.OutputTo acOutputReport, strRptNm, acFormatPDF, strFileNm
DoCmd.Close acReport, strRptNm
DoCmd.OpenReport strRptNm, acViewPreview, , "R_Label1 = '" & "PSD" & "' "
DoCmd.OutputTo acOutputReport, strRptNm, acFormatPDF, strFileNm
DoCmd.Close acReport, strRptNm
DoCmd.OpenReport strRptNm, acViewPreview, , "R_Label1 = '" & "BPD" & "' "
DoCmd.OutputTo acOutputReport, strRptNm, acFormatPDF, strFileNm
DoCmd.Close acReport, strRptNm
DoCmd.OpenReport strRptNm, acViewPreview, , "R_Label1 = '" & "PPD" & "' "
DoCmd.OutputTo acOutputReport, strRptNm, acFormatPDF, strFileNm
DoCmd.Close acReport, strRptNm
Exit Sub
ErrorHandler:
MsgBox "Error #: " & Err.Number & vbCrLf & Err.Description
End Sub
As I run the VBA I can see the all the Reports in preview so I believe that the filter is working. The Output to is falling down.
I accept that my code could work better. I tried writing code as a loop. It did work but as there are only five variables and over 1000 results in the query it took forever to loop through. I tried a Select Case Statement but couldn't get that going.
I would really value some guidance on how to do this.
Thanks in advance
Paul

I've been trying for a while now to get my code going..Feeling bit like my friend to my right..... :banghead:
Allow me to explain. I have a Report that has a 'Division' as a Header.
A Division can be one of five variables ("CPD","SND","PSD","BPD","PPD")
Ideally want to output the report as a type PDF for each Division. Here, have 5 reports in a folder. I am only getting one. I know that the missing reports is not null. That is they have records.
Here is the code I have cobbled together...
Private Sub Print1_Click()
Dim PathNm As String
Dim RptNm As String
Dim strFileNm As String
Dim Sql As String
Dim db As DAO.Database
Dim rs As DAO.Recordset
On Error GoTo ErrorHandler
strPathNm = "D:\Stock\"
strRptNm = "BCSP Summary Report"
Sql = "SELECT DISTINCT R_Label1 FROM Ring Report"
Set db = CurrentDb()
Set rs = db.OpenRecordset("BCSP Report")
OwnNm = rs!R_label1
strFileNm = strPathNm & "BCSP_Summary" & "_" & OwnNm & ".pdf"
DoCmd.OpenReport strRptNm, acViewPreview, , "R_Label1 = '" & "CPD" & "' "
DoCmd.OutputTo acOutputReport, strRptNm, acFormatPDF, strFileNm
DoCmd.Close acReport, strRptNm
DoCmd.OpenReport strRptNm, acViewPreview, , "R_Label1 = '" & "SND" & "' "
DoCmd.OutputTo acOutputReport, strRptNm, acFormatPDF, strFileNm
DoCmd.Close acReport, strRptNm
DoCmd.OpenReport strRptNm, acViewPreview, , "R_Label1 = '" & "PSD" & "' "
DoCmd.OutputTo acOutputReport, strRptNm, acFormatPDF, strFileNm
DoCmd.Close acReport, strRptNm
DoCmd.OpenReport strRptNm, acViewPreview, , "R_Label1 = '" & "BPD" & "' "
DoCmd.OutputTo acOutputReport, strRptNm, acFormatPDF, strFileNm
DoCmd.Close acReport, strRptNm
DoCmd.OpenReport strRptNm, acViewPreview, , "R_Label1 = '" & "PPD" & "' "
DoCmd.OutputTo acOutputReport, strRptNm, acFormatPDF, strFileNm
DoCmd.Close acReport, strRptNm
Exit Sub
ErrorHandler:
MsgBox "Error #: " & Err.Number & vbCrLf & Err.Description
End Sub
As I run the VBA I can see the all the Reports in preview so I believe that the filter is working. The Output to is falling down.
I accept that my code could work better. I tried writing code as a loop. It did work but as there are only five variables and over 1000 results in the query it took forever to loop through. I tried a Select Case Statement but couldn't get that going.
I would really value some guidance on how to do this.
Thanks in advance

Paul