I have a report which must be printed as a PDF. I have set the printer default of the report to PDF, which works fine.
I need to have the report PDF name be unique, so that previous copies are not overwritten. I do this by setting the Me.Caption property in the report's On Open area as Me.Caption = "MyName "&Cstr(Now()).
That works fine when I run the report manually, the PDF name includes the date and time. But when I run the report from a command button on a form, the PDF file name is just the file name of the report "MyReportName".
To run the report from the command button I am using:
stDocName = "EODInventoryChangesLog"
DoCmd.OpenReport stDocName, acViewNormal
What am I doing wrong? I suspect that it's how I am calling the report, as when I run the report stand-alone it works fine.
Robert
I need to have the report PDF name be unique, so that previous copies are not overwritten. I do this by setting the Me.Caption property in the report's On Open area as Me.Caption = "MyName "&Cstr(Now()).
That works fine when I run the report manually, the PDF name includes the date and time. But when I run the report from a command button on a form, the PDF file name is just the file name of the report "MyReportName".
To run the report from the command button I am using:
stDocName = "EODInventoryChangesLog"
DoCmd.OpenReport stDocName, acViewNormal
What am I doing wrong? I suspect that it's how I am calling the report, as when I run the report stand-alone it works fine.
Robert