Hello,
I am trying to generate a report to save as a PDF and concatenate different fields into the file name. This file will be saved in a individuals folder depending on a field called CareCoord. On a form a user can click a combo box for a person who they want a report generated upon. There is a second combo box for which you can grab a referral (sub form basically). Also on this form are 2 buttons. There is a Display report button and a Save Report button. The display report does exactly as intended. The Save Report does everything I want it to until the very last line of VBA is executed.
I am still new to access and maybe it's one of my queries. Let me explain a little bit more about my queries and table setup. I have a table called tblTempPath, which gets all my fields I need to figure out the name of the file. I have 2 queries that Append/Delete from the tblTempPath.
Both of these queries seem to be functioning the way I want them to when I run them.
The error that I am getting since I forgot to mention it is : The OutputTo action was cancelled.
Any Ideas guys?
Thanks,
Rick A
I am trying to generate a report to save as a PDF and concatenate different fields into the file name. This file will be saved in a individuals folder depending on a field called CareCoord. On a form a user can click a combo box for a person who they want a report generated upon. There is a second combo box for which you can grab a referral (sub form basically). Also on this form are 2 buttons. There is a Display report button and a Save Report button. The display report does exactly as intended. The Save Report does everything I want it to until the very last line of VBA is executed.
Code:
Dim db As DAO.Database
Dim rst As DAO.Recordset
Dim fn As String
Set db = CurrentDb
DoCmd.SetWarnings False
DoCmd.OpenQuery ("qryDeleteCurrPath")
DoCmd.OpenQuery ("qrySaveAs")
DoCmd.SetWarnings True
Set rst = db.OpenRecordset("tblTempPath")
rst.MoveFirst
fn = rst!FolderPath & "\" & rst!SaveAsName & ".pdf"
' After I F8 through this line it goes to an error
DoCmd.OutputTo acOutputReport, "rptMainReferralFormPrint", acFormatPDF, fn
Both of these queries seem to be functioning the way I want them to when I run them.
The error that I am getting since I forgot to mention it is : The OutputTo action was cancelled.
Any Ideas guys?
Thanks,
Rick A
Last edited: