I'm using the following code (see below) to create a PDF report of the data on the screen at the time.
When trying to open the report, I get an error saying that the report name is misspelled or doesn't exist. If I check the directory it did create the PDF report.
I'm trying to open the newly created report.
Here is the code I'm using:
Private Sub cmdEmailRpt_Click()
On Error GoTo Err_cmdEmailRpt_Click
Dim strAttachTemp As String
Dim strOutputToTemp As String
' check to see if folder c:\users exists on user's hard drive, if not, create
If Len(Dir("C:\Users\gm\Documents\Consultant", vbDirectory)) = 0 Then
strOutputToTemp = "C:\Users\gm\Documents\Consultant\Audit " & "_" & InquiryNum & ".PDF"
strAttachTemp = strOutputToTemp
'''Output to Temp Area (to C Drive)
DoCmd.OutputTo acOutputReport, "rptAudit_Emails", acFormatPDF, strOutputToTemp, False
DoCmd.OpenReport strAttachTemp, acViewPreview
What is the problem?