gdunn59
asked on
Why I'm getting error when trying to open report just created
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\Docum ents\Consu ltant", vbDirectory)) = 0 Then
MkDir "C:\Users\gm\Documents\Con sultant"
End If
strOutputToTemp = "C:\Users\gm\Documents\Con sultant\Au dit " & "_" & 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?
Thanks,
gdunn59
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\Docum
MkDir "C:\Users\gm\Documents\Con
End If
strOutputToTemp = "C:\Users\gm\Documents\Con
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?
Thanks,
gdunn59
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
you're welcome ;) ~ happy to help
ASKER