INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Jobs

How To

Display counts in page footer by randysmid
Posted: 24 Jan 03 (Edited 23 Oct 03)

Hello everyone,
For some reason, it isn't all that easy to count records printed on a page, and display that count inside the page footer.  Here is a technique that works for me:

1) Place a textbox in the footer, and call it txtPageCount.  Be sure to set the Format property to standard, or some other numeric type.  Modify the label, e.g., "Page Counts: ".

2) Click on the Report Properties button (which is located to the left of the horizontal ruler, and just below the toolbars).  Click on the Event tab, then click on "On Open".  Click the 3 dots at the end of the line, then select Code Builder.

3) Go up to the listbox that contains the word "Report", and click on the arrow.  Select "(General)".  The right listbox should now show "Declarations".  Enter this code:
   Public intPageCount As Integer
   '"Public" variables stay alive until the report finishes

4) Scroll back down to "Private Sub Report_Open..." and paste this code in to the procedure:  
   ' the following code initializes the variable
    intPageCount = 0

5) Go back to listbox that contains the word "Report", and select "Detail", then select "Print" in the righthand listbox.  Enter the following code:
   ' increment intPageCount for each record printed
    intPageCount = intPageCount + 1

6) Go back to the listbox and select "PageFooterSection", and select "Format" in the righthand listbox.  Insert this code:
    'set the textbox in the footer to intPageCount
    txtPageCount = intPageCount
    'reset our counter (intPageCount)
    intPageCount = 0

That's it!!!

Feedback, comments?  
Randy Smith, MCP
rsmith@cta.org    

Back to Microsoft: Access Reports FAQ Index
Back to Microsoft: Access Reports Forum

My Archive

Resources

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close