Hi
Can anyone help with this.
I currently use the following code to save a report as a pdf to my desktop. that all works fine but I need to somehow make sure it saves the report for the record I am on in the form. At the moment it just saves the first record.
I do have ID fields on form and report but dont know what code to use to ensure it saves the current record.
I was kindly given this code as beginner.
Thanks
Can anyone help with this.
I currently use the following code to save a report as a pdf to my desktop. that all works fine but I need to somehow make sure it saves the report for the record I am on in the form. At the moment it just saves the first record.
I do have ID fields on form and report but dont know what code to use to ensure it saves the current record.
I was kindly given this code as beginner.
Thanks
Code:
Dim FileName As String
Dim FilePath As String
Dim UserLogin As String
On Error GoTo My_ErrorHandler:
UserLogin = Environ("UserName")
FileName = "DevelopmentPack"
FilePath = "C:\Users\Jonathan\Desktop\" & FileName & ".pdf"
DoCmd.OutputTo acOutputReport, "rptMainReport", acFormatPDF, FilePath
MsgBox "Development Pack has been successfully saved as a PDF to Desktop", vbInformation, "Save confirmed"
exit_My_ErrorHandler:
Exit Sub
My_ErrorHandler:
MsgBox "Error # :" & err.Number & ", " & err.Description, vbExclamation
Resume Next