Connie said:
I have a report that is first grouped by Stores & then grouped by Dates. I
know you can create a textbox that will number each line by setting the
Running Sum, but you can only choose over group or over all. If I select by
group, it resets the number back to 1 for each date under that Store, but I
need it to continue for the Store .... then reset back to 1 for the next
Store.
"Marshall Barton" wrote
Connie, I see that you've managed to get something working
so this may be redundant. However, I've been playing around
with your issue and think I might have come up with a way
that's relatively(?) straightforward. Anyway, here's some
possible food for thought.
Just for explanatory purposes, I named your detail section's
Over Group running sum text box (with the expression =1),
txtRunCnt.
Then, I created another Over Group running sum text box
named txtGrpCnt in the dates footer section. The expression
for this text box is =txtRunCnt. This will accumulate the
total number of detail lines in the stores group.
Next I added still another text box (named txtRunGrp) to the
report header section as a global place to save the
accumulated number of details in the preceeding dates
groups. (You could use a module level variable for this
purpose if you prefer.)
I then added a line of code to the stores group header
section's Format event:
Me.txtRunGrp = 0
to initialize the report header text box at the start of
each stores group.
To set the value of the txtRunGrp text box, I added a line
of code to the dates footer section's Format event:
Me.txtRunGrp = Me.txtGrpCnt
Finally (whew!), I could display the line numbers the way
you want by using a detail section text box with the
expression =[txtRunCnt] + [txtRunGrp]
The reason I went all over the place with this is to avoid
using any unreliable calculations in event procedures. I
don't know what code you actually ended up with, but keep in
mind that it is not possible to use event procedure VBA code
to reliably calculate a value that depends on values from
other than the current detail.