![]() M圜ounter & ” – Sending to District ” & Format(rs!DISTRICT, “000”) & vbCrLf & _ĭoCmd.OpenReport MyReport, acViewPreview,, MyFilterĭoCmd. If Len(Dir(MyPath_inLoop, vbDirectory)) = 0 Then To open the report immediately after you export it, select the Open file after publishing check box. ![]() To change the name that the report is saved as, type a new file name in the File name box. MyPath_inLoop = MyPath & “D” & Format(rs!DISTRICT, “000”) In the Publish as PDF or XPS dialog box, in the Save as type box, select the file type that you want to export the report as. ![]() Set rs = CurrentDb.OpenRecordset(“DistrictList”, dbOpenDynaset, dbReadOnly) This Access VBA Tutorial will discuss how to interact with Access Reports using VBA. Me.CurrentStatus = "Sending Reports: Completed." & vbCrLf & "Placed at: " & vbCrLf & "Q:PRODDATAReportsAllRecip" & vbCrLf & "S:SystemsReports" & vbCrLf & vbCrLf & Me.CurrentStatus Set fs = CreateObject("Scripting.FileSystemObject")įs.CopyFile MyPath & MyFilename, "Q:PRODDATAReportsAllRecip" & MyFilenameĭoCmd.OpenReport "1020_Report2", acViewPreview,, MyFilterįs.CopyFile MyPath & MyFilename, “Q:PRODDATAReportsAllRecip” & MyFilename Once you see it works, you can change True to False so that the file created is not opened after completion.ĭoCmd.OpenReport "1010_Report1", acViewPreview,, MyFilterĭoCmd.OutputTo acOutputReport, "", acFormatPDF, MyPath & MyFilename, False ![]() Me.CurrentStatus = "Sending Reports." & vbCrLf & vbCrLf & vbCrLf & "=" & vbCrLf & Me.CurrentStatus Using VBA, how do I export a report to PDF in Microsoft Access?Īccess 2010 option of opening report and outputting to PDF using the Access engine, not Adobe Acrobat Printer: see EXAMPLES
0 Comments
Leave a Reply. |