Results 1 to 7 of 7
  1. #1
    Sck is offline Advanced Beginner
    Windows XP Access 2007
    Join Date
    Jul 2010
    Posts
    82

    How to run formating code on a report when exporting to pdf

    I have a report that runs formatting code in the load event. However, the report is normally saved off as a pdf so I added a button with the following code:



    strPath = Application.CurrentProject.Path & "\" & Me.cboCA.Column(1) & ".pdf"
    DoCmd.OutputTo acOutputReport, "rptCAA", acFormatPDF, strPath

    this works but the formatting code is never triggered. I have tried adding the code in several different report events but can't seem to get it to run when the above code runs.

    Any help is appreciated!

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,770
    Might have to open the report in Print Preview then do the export of the open report.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  3. #3
    Sck is offline Advanced Beginner
    Windows XP Access 2007
    Join Date
    Jul 2010
    Posts
    82
    That is what I have been doing and it works but it adds several more "clicks" to the process. This report can be run 20+ times in a row and it gets to be a bother.

  4. #4
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,770
    Why is it run 20+ times in a row? Why are there more clicks?
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  5. #5
    Sck is offline Advanced Beginner
    Windows XP Access 2007
    Join Date
    Jul 2010
    Posts
    82
    it is run on different customers.

    Click count to save as pdf from form view:
    click to open the report
    R-click to bring up shortcut menu
    click to save as pdf
    Enter name
    click OK

  6. #6
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,770
    The single click to open report can also do the export and print and close report, all in one procedure. The OutputTo will use the open report.

    As for naming the document, could this be automated based on some data in the record or have user input this in a textbox before executing code?

    And printing multiple customer reports can also be automated if the customers can be selected by some filter criteria. Open recordset object in VBA and cycle through records.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  7. #7
    Sck is offline Advanced Beginner
    Windows XP Access 2007
    Join Date
    Jul 2010
    Posts
    82
    didn't think about open - export - close.......

    The naming is automated based on the customer but the selection of customers is for the most part random. I could pull based on activity but that would still miss a number of them.

    Thanks! solved the issue!

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Conditional formating in a report
    By msmithtlh in forum Programming
    Replies: 12
    Last Post: 03-20-2013, 02:25 PM
  2. Replies: 3
    Last Post: 12-19-2012, 03:45 AM
  3. Formating report
    By Bajaz001 in forum Reports
    Replies: 3
    Last Post: 04-17-2011, 01:29 AM
  4. Conditional Formating (Report Field)
    By mlawson6128 in forum Programming
    Replies: 1
    Last Post: 03-10-2011, 11:23 PM
  5. Conditional Formating In A Report
    By cadsvc in forum Reports
    Replies: 11
    Last Post: 11-02-2010, 04:47 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums