Hi all
I'm running a report consisting of up to 10 pages from VBA. All pages are printing correctly with the DoCmd.OpenReport, however, leaves the last section of the report out when it exports the report to pdf. I've added a pause in between with no luck.
Does anyone know why this is happening?
I'm running a report consisting of up to 10 pages from VBA. All pages are printing correctly with the DoCmd.OpenReport, however, leaves the last section of the report out when it exports the report to pdf. I've added a pause in between with no luck.
Does anyone know why this is happening?
Code:
Private Sub ReproductionID_Click()
Dim Filename As String
Dim Name As String
Dim Litter As String
Name = Me.Mother
Litter = Me.MLitterCount
Filename = "C:\LitterRecords\Litter Record - " & Name & "- Litter " & Litter & ".pdf"
DoCmd.OpenReport "rptCompleteLitterRecord", acViewPreview, , "ReproductionID=" & Me.ReproductionID & "And MLitterCount=" & Me.MLitter, acHidden
Sleep 10000
DoCmd.OutputTo acOutputReport, "rptCompleteLitterRecord", acFormatPDF, Filename
Sleep 10000
DoCmd.Close acReport, "rptCompleteLitterRecord", acSaveNo
End Sub