Results 1 to 4 of 4
  1. #1
    EddieN1 is offline Competent Performer
    Windows XP Access 2007
    Join Date
    May 2011
    Posts
    313

    Detecting Report Phase using VBA When Using [Pages]


    I have a report that uses the [Pages] property. When the report is run, Access makes two "passes" or "phases"... the first formats the Report in the ether and counts the Pages, then it starts over and begins formatting for real and [Pages] contains the total number of pages in the report. Is there a way in VBA to tell which of the two "passes" or "phases" it is in during a Formatting Event? Thanks, Eddie

  2. #2
    ItsMe's Avatar
    ItsMe is offline Sometimes Helpful
    Windows 8 Access 2013
    Join Date
    Aug 2013
    Posts
    7,862
    The way I approach it is to open the VBA editor and look at the Report's module. There, you can use the pulldown at the top left of the VBA Editor window to select various members associated with your Report. Then, the pulldown on the right will list that member's Events. What I will do is focus on the various Format Events available.

    For instance, both the Page and the Pages property will already be initialized during the Format event for the Page Header and Page Footer. I believe it is also available in the Report's header and footer Format event. I am having a hard time imagining a Format event that the Page and Pages properties are not initialized.

    Usually, the issue is getting data from the Detail section of a specific group to display in a Header or Footer of another Group, Report, or Page.

  3. #3
    EddieN1 is offline Competent Performer
    Windows XP Access 2007
    Join Date
    May 2011
    Posts
    313
    I found an easy solution to this. Test Me.Pages... during the first phase, it is set to zero. During the second phase, Me.Pages is non-zero.

  4. #4
    ItsMe's Avatar
    ItsMe is offline Sometimes Helpful
    Windows 8 Access 2013
    Join Date
    Aug 2013
    Posts
    7,862
    Quote Originally Posted by EddieN1 View Post
    ...the first formats the Report in the ether and counts the Pages, then it starts over and begins formatting for real ...
    I guess it makes sense to get the page count when the Report formats for real.

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

Similar Threads

  1. i want to type the moon phase percentage first in the box
    By TheSpecialist in forum SQL Server
    Replies: 1
    Last Post: 03-21-2016, 12:57 PM
  2. Report printing extra pages of the same report.
    By khughes46 in forum Reports
    Replies: 5
    Last Post: 06-19-2014, 07:39 AM
  3. design phase ... question on multiple entries from same table
    By sbrockett751 in forum Database Design
    Replies: 2
    Last Post: 03-13-2013, 03:13 PM
  4. Report pages
    By combine21 in forum Reports
    Replies: 1
    Last Post: 03-05-2011, 04:39 PM
  5. Blank pages between report pages
    By jonsuns7 in forum Reports
    Replies: 2
    Last Post: 10-01-2009, 05:06 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums