Option Compare Database
Sub PDF_Export()
Const RN As String = "Remote Support Report"
Const PATH As String = "C:\Temp\Remote\"
Const SQL As String = _
"SELECT DISTINCT Customer " & _
"FROM [Remote Support Query] " & _
"ORDER BY Date "
With CurrentDb.OpenRecordset(SQL)
Do While Not .EOF
' set the value of the TempVar the report will expect
TempVars!Customer = !Customer.Value
' output the report to pdf
DoCmd.OutputTo acOutputReport, RN, acFormatPDF, PATH & !Customer & ".pdf"
.MoveNext
Loop
.Close
End With
End Sub