Saving Access Reports as PDFs

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • nicodg
    New Member
    • Nov 2011
    • 7

    Saving Access Reports as PDFs

    ** Edit ** This post was added to an existing thread (How to save an Access report to pdf with filename based on fieldname) in error so it's been moved here.

    Hello to all again.

    my little access query (see above), thanks to you, meets some great succes by other users. In that way that they would to integrate this to other entities. One of the users asked me if it was possible to modify it a little to obtain next result. So I need you high competencies again :o)

    actually: selecting custumer nr from droplist, click on button, filtered report is created and saved as pdf file with given name (based on fieldname)

    would like doing : instead of selecting customer nr from droplist just click on button, run report and save every entity, which appears in the report, as pdf file also with given name (based on fieldname.

    Is this technically possible???

    Once again thanks in advance

    KR

    Nicolas
    Last edited by NeoPa; Nov 30 '11, 04:22 PM. Reason: Preparing to split to it's own, separate, thread.
  • Mihail
    Contributor
    • Apr 2011
    • 759

    #2
    What mean "every entity, which appears in the report" ?
    Automatic save a .pdf file for each customer in your list ?

    Comment

    • nicodg
      New Member
      • Nov 2011
      • 7

      #3
      Hello Mihail,

      Thansk for replying

      First I have to refer to a previous topic: "How to save an Access report to pdf with filename based on fieldname" in which you can find som more details.

      But resumed:
      I need to send every month an account statement to each of our entities all over the world. Today's actionflow is:
      - select customer nr from drop list ( 1 cust nr = 1 entity)
      - click button which runs a code (first: filtering all information, from a global excel file, refering to the selected cust nr, Second: save output into pdf file by given it a specific name based on fieldname. (this works actually fine)

      Question is:

      just one click on a button, this will create an access report file considering all customer nr. Output in pdf file. But, if report shows 10 customer nr; then I need:
      - 10 pdf file; one for each customer
      - name of each pdf file must be/contain :"custumer nr" and "name"

      Hope this will clarify a little more
      Have a nice day

      Comment

      • TheSmileyCoder
        Recognized Expert Moderator Top Contributor
        • Dec 2009
        • 2322

        #4
        This is where looping through a recordset comes in Handy.
        Code:
        Dim rsCustomers as Dao.Recordset
        Dim strSQL as String
        dim strReportName as string
        
        strSQL="SELECT SAP,Cust,Hyperion " & _
               "FROM [Hyperion accounts] " & _
               "ORDER BY [SAP];"
        '(This may need to have a WHERE clause applied to it)
        set rsCustomers=CurrentDB.Openrecordset(strsql,dbopendynaset)
        Do while not rsCustomers.EOF 
         strReportName = rsCustomers!Cust & "-" & rsCustomers!Hyperion & ".pdf"
         DoCmd.OutputTo acOutputReport, "Rep Hyperion recon", acFormatPDF, myPath + strReportName, True 
         rsCustomers.MoveNext
        Loop
        
        'Cleanup
        set rsCustomers=nothing
        This will print ALL your customers, so you need some way to specify which customers to print, I suppose it could be based on which customers have had orders this month, but I dont really have the details to specify such a where clause.

        Comment

        • nicodg
          New Member
          • Nov 2011
          • 7

          #5
          Hello to all and sorry for this (very) late reply.
          Once again I have received an answer to my problem
          And once again it works fine...

          thanks a lot for this great Forum

          Comment

          • TheSmileyCoder
            Recognized Expert Moderator Top Contributor
            • Dec 2009
            • 2322

            #6
            Better late then never!

            Good to see it worked for you.

            Comment

            Working...