By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
429,251 Members | 2,760 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 429,251 IT Pros & Developers. It's quick & easy.

Print all open database objects

P: 16
I need two reports to print at the same time. Repor1 is always the same. There is a button on Report1 that when pressed will open one of several other reports based on the value entered in one of the controls on Reprt1. This report becomes Report2, the second report that I need to print. Basically Report1 is a given and Report2 is a variable that changes from record to record. Once they are both open, I would like to be able to print both of the reports at once so that the user doesn't have to print them both separately. What is the best way to achieve this? Can I program it into my existing button? Thanks.
4 Weeks Ago #1
Share this Question
Share on Google+
2 Replies


twinnyfo
Expert Mod 2.5K+
P: 3,257
When you open your report, the acViewNormal property causes the report to be sent to your default printer with the printerís default settings.

Hope this hepps.
3 Weeks Ago #2

ADezii
Expert 5K+
P: 8,627
  1. The way that I interpret your Request is that you need two things to happen prior to actually Printing the Reports:
    1. You need to make sure that at least two Reports are 'Open'.
    2. If at least two Reports are 'Open', then you need to make sure that they are the correct ones to Print.
    3. Once the previous conditions are met, then Print both Reports.
  2. These things can easily be accomplished by looking at the Reports Collection as well as using a couple of Boolean Variables.
  3. The following Code should accomplish what you have requested. For the purposes of this Demo, I named the Reports Shippers and Suppliers.
  4. Code Definition:
    Expand|Select|Wrap|Line Numbers
    1. Dim rpt As Access.Report
    2. Dim blnShippersFound As Boolean
    3. Dim blnSuppliersFound As Boolean
    4.  
    5. 'Need at least 2 Reports Open
    6. If Application.Reports.Count < 2 Then Exit Sub
    7.  
    8. For Each rpt In Application.Reports
    9.   Select Case rpt.Name
    10.     Case "Shippers"
    11.       blnShippersFound = True
    12.     Case "Suppliers"
    13.       blnSuppliersFound = True
    14.     Case Else   'don't really care
    15.   End Select
    16. Next
    17.  
    18. 'Both need to be Opened
    19. If (blnShippersFound And blnSuppliersFound) Then
    20.   With DoCmd
    21.     .OpenReport "Shippers", acViewNormal
    22.     .OpenReport "Suppliers", acViewNormal
    23.   End With
    24. End If
3 Weeks Ago #3

Post your reply

Sign in to post your reply or Sign up for a free account.