How to print multiple reports at a time

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • mfuentes74
    New Member
    • Sep 2009
    • 5

    How to print multiple reports at a time

    I have about 7 reports in access I need to print on a weekly basis. I wanted to know if there is any way I can do this faster then printing individual reports.
  • ADezii
    Recognized Expert Expert
    • Apr 2006
    • 8834

    #2
    The trick is to preface each of the 7 Reports with a Unique Qualifier as identified by the Constant con_ID_PREFIX. When you run the following code, only those reports containing this Unique Prefix will be printed. In this demo I simply used rptPer:
    Code:
    Dim obj As AccessObject
    Const con_ID_PREFIX As String = "rptPer"
    
    For Each obj In Application.CurrentProject.AllReports
      If Left$(obj.Name, 6) = con_ID_PREFIX Then
        'Print Report if it contains the Prefix
        DoCmd.OpenReport obj.Name, acViewNormal      
      End If
    Next obj

    Comment

    • skygoodwin
      New Member
      • Mar 2010
      • 4

      #3
      Couldn't you also simply create a macro with seven separate actions of "OpenReport " where the View setting is set to "Print."

      Between each "OpenReport " action, you could insert a "Close" action that closes each specific report with it set to either save or not save the report upon closing.

      The macro could be tagged to a button on a form or whatever you'd want so you could print all seven reports with one click.

      Comment

      • ADezii
        Recognized Expert Expert
        • Apr 2006
        • 8834

        #4
        You definitely could take that approach, but I'll rarely suggest the use of a Macro over VBA Code for multiple reasons, the most critical of which is that there is no mechanism to Trap any Error(s) that may occur.

        Comment

        • NeoPa
          Recognized Expert Moderator MVP
          • Oct 2006
          • 32653

          #5
          Using macros is not generally recommended for various reasons, the principal being that they have such a limited interface. Why spend effort learning a system equivalent to a pair of trousers (pants) with a belt around the knees. That said, we welcome all ideas, and your contribution is appreciated.

          The reports would also need to be printed of course, and potentially closed depending on requirement. Printing is done using DoCmd.PrintOut( ).

          Welcome to Bytes!

          Comment

          Working...