Results 1 to 4 of 4
  1. #1
    New Lounger
    Join Date
    Jul 2013
    Location
    Blacktown NSW Australia
    Posts
    4
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Access Report Pages (AC2013)

    I am attempting to print individual pages of a report to pdf.
    Part of the exercise requires me to cycle through the Report pages and see if certain criteria is met before printing. I need to find out howmany pages are in the Report. In testing, the following code results in NPages = 0.

    Any Advice?

    Sub PrintDues()
    '
    Dim NPages As Integer
    '
    '
    DoCmd.OpenReport "rptMembersDues", acViewPreview
    '
    NPages = Reports("rptMembersDues").Pages

    End Sub

    Ross

  2. #2
    3 Star Lounger HiTechCoach's Avatar
    Join Date
    Sep 2011
    Location
    Oklahoma City, OK
    Posts
    200
    Thanks
    0
    Thanked 31 Times in 30 Posts
    Interesting approach. I am not sure if it is even possible to get what you want using this method.

    I have been doing membership databases for 15+ years with Access and other databases.

    I find it much easier to first select the records you want to print first. Then loop through the records and print each report one at a time.

    I have created an example that may help: Batch Printing and Save As PDF
    Boyd Trimmell aka HiTechCoach (Access Information here)
    Microsoft MVP - Access Expert
    "If technology doesn't work for people, then it doesn't work."

  3. #3
    New Lounger
    Join Date
    Jul 2013
    Location
    Blacktown NSW Australia
    Posts
    4
    Thanks
    1
    Thanked 0 Times in 0 Posts
    Wow, Thanks Boyd.

    Looked at your sample database, and figured it will take me a while to understand the mechanics. I don't quite have that complexity as I have a one to many relationship only with the members Table and a Dues transactions table. (Transactions include Opening Balance, Dues, AmtPaid, and Adjustments). I can then calculate a closing balance. So.... If I created/modified the current query to run the report so that only Members with e-mail addresses were selected, I could then use your method of cycling through the record set, and creating a pdf of the current page.
    Whew
    Automatically sending the e-mail is another project. But lets settle this one first.

    Ross

  4. #4
    3 Star Lounger HiTechCoach's Avatar
    Join Date
    Sep 2011
    Location
    Oklahoma City, OK
    Posts
    200
    Thanks
    0
    Thanked 31 Times in 30 Posts
    Ross,

    What you need to do is almost exactly like the example I posted. You will use the same code as in the command button on the form. The difference will be the way you select the records. Instead of using the form, you will use a query to sect the member with dues not paid that need an invoice.

    Using he same code in my like in my example you can add a line of VBA code after the PDF is created to email it.

    If I were dong it, I would use a form like in my example. The form would only show the members that need an invoice. You select the ones you want to print or email. Using this same form you code reprint or re-email a single invoice.

    FYI: The way you were trying to do it will be much harder to code than my example.
    Boyd Trimmell aka HiTechCoach (Access Information here)
    Microsoft MVP - Access Expert
    "If technology doesn't work for people, then it doesn't work."

Posting Permissions

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