Solved Save Report to PDF VBA, not saving last part of report

Momma

Member
Local time
Tomorrow, 08:32
Joined
Jan 22, 2022
Messages
130
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?


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
 
What happens if you just use the OutputTo CMD?
 
What happens if you just use the OutputTo CMD?
It saves the pdf file but the last section of the report is not included but it's there when I run the report.
 
Can you run on another computer?, else upload enough for someone else to try.
 
can you show a snapshot of your report including the "last portion"?
 
It saves the pdf file but the last section of the report is not included but it's there when I run the report.
Sometimes it is very helpful to provide details. The "last section" is generic enough to possibly include more than one thing, so it's harder to guess what that problem could be. Show the details if possible, highlighting whatever is not being included.
 

Users who are viewing this thread

Back
Top Bottom