PDF Report Troubles

hkimpact

Registered User.
Local time
Today, 02:08
Joined
Apr 27, 2012
Messages
51
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.

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
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
 
Last edited:
Ok after looking at this for an hour, I realized that this was a dumb mistake on my part. I have a table with all the paths to each employee folder. Well my test folder wasn't sent to the correct path. I always ask questions before I investigate thoroughly. Thanks though guys.
 

Users who are viewing this thread

Back
Top Bottom