Hey Everyone, I’m trying to export a 7 page document (7 suppliers , 1 supplier to a page) to 7 individual PDF not 1 PDF with 7 pages, I've tried to research and recreate but it’s not working so thought I 'd ask the question, below is my VBA code.
Currently my query to collect the data pulls 48 lines, when running the below, it prints 48 PDFS each pdf holding 7 pages
This action occurs on a button.on_click function in VBA
Dim strR As String
Dim strWhere As String
strR = "3_Rpt_hardware_new_request"
Set rs = CurrentDb.OpenRecordset("3_Qry_hardware_new_request")
With rs
.MoveFirst
Do While rs.EOF = False
strWhere = "SupplierID = " & rs!SupplierID
MsgBox strWhere
DoCmd.OpenReport strR, acViewPreview, strWhere, , acHidden
InvoiceNumber = "DPO" & Format(SupplierID, "00") & Format(Date, "mmdd")
Number = CStr(InvoiceNumber)
DoCmd.OutputTo acOutputReport, strR, acFormatPDF, Environ("UserProfile") & "\Desktop\" & Number & ".pdf", False
DoCmd.Close acReport, strR
.MoveNext
Loop
End With