Hey everyone,
Here is my situation. I have created a report in Access for around 800 uniquely identified line items. My end goal is to develop a script that will Print a PDF for each unique identifier and save them all in one folder and have each one named by unique identifier. Below is the script I have written, but for the life of me I cannot get through the Run-Time Error 91. The data is being derived from a SQL database. Any help is appreciated!
Here is my situation. I have created a report in Access for around 800 uniquely identified line items. My end goal is to develop a script that will Print a PDF for each unique identifier and save them all in one folder and have each one named by unique identifier. Below is the script I have written, but for the life of me I cannot get through the Run-Time Error 91. The data is being derived from a SQL database. Any help is appreciated!
Private Sub Command35_Click()
Dim rst As ADODB.Recordset
Set rst = Currentdb.OpenRecordset("SELECT DISTINCT [Unique_Identifier] FROM [tbl_questionnaire] ORDER BY [Unique_identifier];", dbOpenSnapshot)
Do While Not rst.EOF
strRptFilter = "[Unique_identifier] = " & rst![UNIQUE_IDENTIFIER]
DoCmd.OutputTo acOutputReport, "eDeliverableReport", acFormatPDF, "C:\Users\Me\Desktop\Reports" & "\" & rst![UNIQUE_IDENTIFIER] & ".pdf"
DoEvents
rst.MoveNext
Loop
rst.Close
Set rst = Nothing
End Sub