Hi,
I have cobbled together some code to 1) open a report based on a query, 2) save the report,
The trouble I am having is using a text box value from the report as part of the filename.
Here is the code I am currently using
Code:
Function Macro2()
Dim myPath As String
Dim strReportName As String
DoCmd.OpenReport "Results Certificate 2", acViewReport, "", "", acNormal
myPath = "C:\Users\Dave\desktop\"
strReportName = ![labNumber] & ".pdf"
DoCmd.OutputTo acOutputReport, "Results Certificate 2", acFormatPDF, myPath & strReportName, False
DoCmd.Close acReport, "Results Certificate 2"
End Function
it is the strReportName = labNumber which I am having problems with.
This is based on a text box called "labNumber", from a table called "Cat Details" if that is required.
Without that line the rest of works fine.
I have tried various ways of representing it from searches i have preformed over several hours, but nothing has solved it.
Any help at all would be hugely appreciated.
Thanks