Seems very simple but I can't seem to make it work properly.
I have a macro created for me which exports reports as pdf files. WHich works great.
However I'd like field ("Printed") in my "Contracts" table to be updated with "Yes" when the report is exported.
Here's the existing code:
Private Sub Command31_Click()
Dim oApp As Object
Dim oEmail As Outlook.MailItem
Dim fileName As String
Dim rst As DAO.Recordset
Set rst = CurrentDb.OpenRecordset("SELECT DISTINCT [Account], [InvoiceNum], [EmailAddress], [Company] FROM [ContactTotalsNoEmail] WHERE (((Contracts.SelectedPrint)=True)) ORDER BY [Account];", dbOpenSnapshot)
Do While Not rst.EOF
strRptFilter = "[InvoiceNum] = " & Chr(34) & rst![InvoiceNum] & Chr(34)
fileName = "C:\Scripts" & "\" & rst![Account] & " - " & rst![InvoiceNum] & ".pdf"
DoCmd.OutputTo acOutputReport, "InvTotalNoEmail", acFormatPDF, fileName
Set rst = Nothing
I couldn't fingure it with rst, so tried to create rst2 but it would not update the correct records.
rst2!Print = Yes
Can anyone assist?