I have a piece of VBA code written for me which outputs selected records as pdf reports.
Is it possible to amend the code so that instead of exporting as a PDF, it will print through the default printer?
All my attempts so far just print the active object ie the form itself.
Here's what I currently have:
Private Sub Command28_Click()
Dim oApp As Object
Dim oEmail As Outlook.MailItem
Dim fileName As String
Dim rst As DAO.Recordset
Set rst = CurrentDb.OpenRecordset("SELECT [Account], [InvoiceNum], [EmailAddress], [Company], [Printed] FROM [ContactTotalsNoEmail] WHERE (((Contracts.SelectedPrint)=True)) ORDER BY [Account];", dbOpenDynaset)
Do While Not rst.EOF
strRptFilter = "[InvoiceNum] = " & Chr(34) & rst![InvoiceNum] & Chr(34)
fileName = "C:\Scripts\NoEmail" & "\" & rst![Account] & " - " & rst![InvoiceNum] & ".pdf"
DoCmd.OutputTo acOutputReport, "InvTotalNoEmail", acFormatPDF, fileName
rst![Printed] = "Yes"
Set rst = Nothing
Any help would be greatly appreciated.