Avatar of SteveL13
SteveL13Flag for United States of America

asked on 

Number a report by groups

I have a report that has groups.  I want to somehow number the groups on the report so the first group is "1 of 2", the second group is "2 of 2".  Kind of like page numbering but with groups,  How can this be done?
Microsoft Access

Avatar of undefined
Last Comment
SteveL13
ASKER CERTIFIED SOLUTION
Avatar of PatHartman
PatHartman
Flag of United States of America image

Blurred text
THIS SOLUTION IS ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
Avatar of SteveL13
SteveL13
Flag of United States of America image

ASKER

Jim, I'm getting "subscript out of range".

This line is highlighted in yellow when I debug:

Me!ctlGrpPages = "Page " & GrpArrayPage(Me.Page) & " of " & GrpArrayPages(Me.Page)
Did you modify the last line here:

  If Me.Pages = 0 Then
    ReDim Preserve GrpArrayPage(Me.Page + 1)
    ReDim Preserve GrpArrayPages(Me.Page + 1)
    GrpNameCurrent = Me!ID

 to pickup the ID of your group?  That's the only change you need to make to get it to work.

Jim.
Avatar of SteveL13
SteveL13
Flag of United States of America image

ASKER

Yes.  Changes to:
GrpNameCurrent = Me!CombinedDesignElements

CombinedDesignElements is the only field in the group header.  Plus I copied it to the group footer.
Hum..should work fine.   You have the code in the page footer's OnFormat event?   OnPrint will not do the job.

Jim.
Avatar of SteveL13
SteveL13
Flag of United States of America image

ASKER

Yes.
Any chance you can do a small sample DB?   I've been using this code for years and have never had an issue with it.

 The only other thing I can think of is if your modifying the resulting report layout between the first pass and second pass.  This would occur if you do something in the OnPrint event (like make a page break visible).

 OnPrint does not fire on the first pass, so if your doing things there that would alter the layout, you'd get a different number of pages between the two passes.

Jim.
Avatar of PatHartman
PatHartman
Flag of United States of America image

Steve, I thought you wanted to number the groups.  Doesn't the code you were given number the pages?
Good gosh....I totally missed that.  Thanks for pointing that out.  I thought he wanted page x of y over a group.

  Still could use the same basic technique using the two pass printing.   I'll work something up in the morning.

Jim.
Avatar of SteveL13
SteveL13
Flag of United States of America image

ASKER

Pat, I ended up using your solution.
Microsoft Access
Microsoft Access

Microsoft Access is a rapid application development (RAD) relational database tool. Access can be used for both desktop and web-based applications, and uses VBA (Visual Basic for Applications) as its coding language.

226K
Questions
--
Followers
--
Top Experts
Get a personalized solution from industry experts
Ask the experts
Read over 600 more reviews

TRUSTED BY

IBM logoIntel logoMicrosoft logoUbisoft logoSAP logo
Qualcomm logoCitrix Systems logoWorkday logoErnst & Young logo
High performer badgeUsers love us badge
LinkedIn logoFacebook logoX logoInstagram logoTikTok logoYouTube logo