Results 1 to 2 of 2

Printing Reports through Program

  1. #1
    Kundan is offline Advanced Beginner
    Windows XP Access 2013 32bit
    Join Date
    Mar 2018

    Printing Reports through Program

    I have 5 Reports and want to print them one below the other. I would also like to check whether any Report has null values so that I can skip that Report. How can I do it through Program.

  2. #2
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    you check to see if the query in the report has zero recs:
    have a table ,tRpts2Print to hold the reports you want to print
    it has 2 fields: Qry, Rpt. (the query in the report, and the name of the report)
    the code below gets each report, 1 by 1,
    checks if the query has records in it, if so, print it

    Public Sub PrintRptsViaQry()
    'PrintIfRecs "qsQry1", "rRpt1"
    Dim rst
    Dim sSql As String
    Dim vQry, vRpt
    sSql = "Select * from tRpts2Print"
    Set rst = CurrentDb.OpenRecordset(sSql)
    With rst
       While Not .EOF
          vQry = .Fields("Qry").Value
          vRpt = .Fields("Rpt").Value
          PrintIfRecs vQry, vRpt
    Set rst = Nothing
    End With
    End Sub
    Public Sub PrintIfRecs(ByVal pvQry, ByVal pvRpt)
    If DCount("*", pvQry) > 0 Then DoCmd.OpenReport pvRpt
    End Sub

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

Similar Threads

  1. Replies: 8
    Last Post: 09-03-2015, 07:16 PM
  2. Hyperlinks in Reports printing to PDF
    By IslandHydro in forum Programming
    Replies: 3
    Last Post: 06-22-2015, 04:15 PM
  3. Need advice on report printing program
    By mejia.j88 in forum Programming
    Replies: 3
    Last Post: 03-18-2014, 07:42 AM
  4. Printing reports in batches
    By mnsemple83 in forum Access
    Replies: 6
    Last Post: 08-16-2011, 02:41 PM
  5. Printing Reports....
    By Danny Christie in forum Reports
    Replies: 1
    Last Post: 12-06-2006, 04:51 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
Tech Forums: Microsoft Office Forums