-----Original Message-----
Lynn,
Regarding:
When I open the screen, it seems that I
copied the code into the "General" section. Is that where
it should be?
This is in the Report's code window, correct?
Not in one of the database Modules.
The answer is Yes ... and No.
The first 3 Dim statement lines go up in the General section.
The top of the code window (General Section) should look
something like this:
Option Compare Database
Option Explicit
Dim GrpArrayPage(), GrpArrayPages()
Dim GrpNameCurrent As Variant, GrpNamePrevious As Variant
Dim GrpPage As Integer, GrpPages As Integer
======== Line here ======
Then you may (or may not) have some additional event or sub procedures under
the above line.
========== Line here =============
Then, in report design view, right-click on the page footer bar
and select Properties.
Click on the Page Footer Format event line.
Write
[Event Procedure]
Click on the button with 3 dots appears on that line.
The code window will appear with the cursor flashing
in the Page Footer Format event line.
Paste the code (without those top 3 lines that you have already
written at the top of the window).
Private Sub PageFooter_Format(Cancel As Integer, FormatCount As Integer)
** Paste the code here
** Do NOT paste the Private Sub PageFooter etc. line,
** nor the End Sub line as that has already been filled in by Access.
End Sub
======== Line here ============
When done, if you place your cursor on one of the
Dim statements at the top of the sheet, the drop-down
shold indicate 'Declarations'.
If you place your cursor within the Sub PageFooter, the
drop-down will show PageFooter.
You placed an unbound control named ctlGrpPages in the Page Footer.
And you indicated you already have changed the
Me!Salesperson to Me!Loc.
I just did all of this and it does work.
A thought has just occurred to me.
You must also have a control in the report that calculates [Pages].
Anything like =[Page] & " of " & [Pages]
or just =[Pages].
If you don't want to show it, just make it not visible.
This forces Access to Format the report twice.
Once to find the total page count (which also fills the above group arrays),
then again to actually preview or print the report.
I just notice the web site does not explicitly tell you to add the control,
though it does mention the use of [Pages] in passing.
Hope this takes care of it for you. Let me know.
--
Fred
Please reply only to this newsgroup.
I do not reply to personal e-mail.
Lynn said:
Hi, Fred,
It's still not working!
I changed the unbound controls name to ctlGroupPages.
Now, I don't get any error messages - I get nothing at
all. Just an emplty space where the page number should be!
I notice that on the top of that Visual Basic screen
(which I had never seen before Friday), there are 2 drop
downs at the top. One has "General", "Detail", "Page
Footer", etc. When I open the screen, it seems that I
copied the code into the "General" section. Is that where
it should be?
Thanks so much for your help!
Lynn
** snipped **
.