Results 1 to 3 of 3
  1. #1
    Join Date
    Jun 2003
    Posts
    20

    Unanswered: A script to automate printing reports?

    Hi I was wondering if anyone knows of a way in which I could automate the printing of reports in Access 2000. I have about 10 reports which have to be printed out once a week. Rather than have someone manually print them, is there a way in which I could write a script or use a macro to do this automatically?

    Any help or advice is appreciated,
    Ian

  2. #2
    Join Date
    Nov 2003
    Posts
    1,487
    Do you want this to be a scheduled process or something where a user selects a button and all 10 reports are printed at once?

    If it's from a Command button then you could try this:

    Code:
    Private Sub Comman1_Click()     'A Command Button OnClick event.
        Dim NumberOfCopies As Integer
        NumberOfCopies = 1    'If you want 2 copies then NumberOfCopies = 2
    
        For i = 1 To NumberOfCopies
                DoCmd.OpenReport "Report1"
                DoCmd.OpenReport "Report2"
                DoCmd.OpenReport "Report3" 
                DoCmd.OpenReport "Report4"
                DoCmd.OpenReport "Report5"
                DoCmd.OpenReport "Report6"
                DoCmd.OpenReport "Report7"
                DoCmd.OpenReport "Report8"
                DoCmd.OpenReport "Report9"
                DoCmd.OpenReport "Report10"            
        Next i
        DoEvents
    End Sub
    If you add no other parameters other than the report name then the report is spooled to the printer without a preview.

    If you want to carry out your report printing as a scheduled process....well it gets quite a bit more involved.

  3. #3
    Join Date
    Oct 2003
    Location
    Ger
    Posts
    1,969
    Provided Answers: 1
    Originally posted by CyberLynx
    Do you want this to be a scheduled process or something where a user selects a button and all 10 reports are printed at once?

    If it's from a Command button then you could try this:

    Code:
    Private Sub Comman1_Click()     'A Command Button OnClick event.
        Dim NumberOfCopies As Integer
        NumberOfCopies = 1    'If you want 2 copies then NumberOfCopies = 2
    
        For i = 1 To NumberOfCopies
                DoCmd.OpenReport "Report1"
                DoCmd.OpenReport "Report2"
                DoCmd.OpenReport "Report3" 
                DoCmd.OpenReport "Report4"
                DoCmd.OpenReport "Report5"
                DoCmd.OpenReport "Report6"
                DoCmd.OpenReport "Report7"
                DoCmd.OpenReport "Report8"
                DoCmd.OpenReport "Report9"
                DoCmd.OpenReport "Report10"            
        Next i
        DoEvents
    End Sub
    If you add no other parameters other than the report name then the report is spooled to the printer without a preview.

    If you want to carry out your report printing as a scheduled process....well it gets quite a bit more involved.
    Or put the ReportNames in an ARRAY For example Arr_ReportName
    Then use
    For i = 1 to UBound(Arr_ReportName)
        DoCmd.OpenReport Arr_ReportName(i)
    Next


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •