Solved current record PDF issues

With the code I suggested with the code in the link, it’s very easy to reset the SQL to the original. You can also build a fairly sophisticated where clause, apply it, and call it from any form.

Using a control on a form limits you to having that form open and setting the correct value.
 
You have two lines.

The first one opens the report for Preview on-screen. It contains a filter: "EWNID=" & Nz(Me.EWNID, 0)

The second one sends another copy of the report to PDF. This is a different copy of the report, not the one just opened for Preview on-screen. It has no filter. Add your filter to this second line that sends the other copy to PDF.
No so George.

With code
Code:
Sub PrintOneRecord()
DoCmd.OpenReport "rptPressure", acViewPreview, , "PressureID = 13", acHidden
DoCmd.OutputTo acOutputReport, "rptpressure", acFormatPDF, "f:\temp\ReportTest.pdf"
DoCmd.Close acReport, "rptpressure"
End Sub

Result
1745049015077.png
 

Users who are viewing this thread

Back
Top Bottom