Good Day Dears
I Have a Form To Run Report With Condition When I Run The Form The Filter(Condition) Work Correctly For Report
But When I Create PDF( DoCmd.Output
I would base the report on a query (if it's not so already) and since you know the SQL you need for the report at runtime, you can replace the SQL in the QueryDef entirely (with the proper WHERE filter) and just output the report. You do not need to open in beforehand. Omit the OpenReport call and just do something like this:
CurrentDB.QueryDefs("qryMyReportBase").SQL = "SELECT * FROM main WHERE ID LIKE '" & Nz(Me.cmrtxt, "*") & "' AND place_of_discharge_ar LIKE '" & Nz(Me.dischargecombo, "*") & "' AND border LIKE '" & Nz(Me.bordercombo, "*") & "' AND a_date Between " & _
Format(Nz(Me.statrdatetxt, "01/01/1900"), "\#mm\/dd\/yyyy\#") & " And " & _
Format(Nz(Me.enddatetxt, "01/01/2900"), "\#mm\/dd\/yyyy\#")
DoCmd.OutputTo acOutputReport, "Report1", acFormatPDF, "C:\MySavePath\Report1.pdf", False
Obviously, "qryMyReportBase" should be the report's source query and "C:\MySavePath\" should be your save path.
Also, I didn't see anywhere in OutputTo where you were specifying the type as PDF. Since that's what you mentioned above, I've added that in.