Hi,
I am working in Access 97.
I am creating a report based on an Employee table. I’ve created a query for the table since only reports are to be generated only for active employees (non-active ones are still in the Employee table). Each employee is to begin a new page. I have that down – no problem.
The problem is with Access’s numbering of pages. When creating the Report with the Wizard, Access creates a “page of pages” footer.
This may be problematic for the employees. Employee A sees his report as “1 of 5”; Employee B sees her report as, say, “2 of 5”. Etc. So Employee A may ask “where’s the other 4 pages of the 5?” B may ask why her report starts at page 2. So I’m trying to avoid this.
Even if I leave out the [Pages] part, a particular employee’s report, except the first, won’t start at page 1.
So I’m searching for another approach. Ideally, each employee would see “1 of n” and continuing for as many pages as needed for that employee. The next employee would start over at “1 of m”. Next step down in preference would just provide for page numbering as “1”, “2”, etc with no “of n”.
I’ve tried some code for the latter. On Report Open, I set a variable SaveEmployee = “noEmployee”. Then On Page Footer, I examine if EmployeeName (the field from the underling query) = SaveEmployee.
– if so, I increment the page number
– if not, I set the page number = 1 and update SaveEmployee
In either case, I set a control in the footer to my page number as part of the On Footer macro.
The above seems to work as far as the numbering goes – it starts at 1 for each employee. However, since the report isn’t fleshed out yet (just has a group header for the employee name and his/her start date), I can’t tell what will happen if the report goes to page 2. So I just put in some labels and repeated the employee name as a text box in the detail section. What I’m getting is a blank page 1 as far as the report content goes. My labels and text box come out on page 2. When I start a new employee, same thing.
I also thought about accessing the records of the table directly from within a loop and opening the report with a Where string constructed for each employee. I haven’t tried this yet. This would seem like it should solve all the problems and even give me the “1 of n” and start over for each employee. But I do have concerns about the speed of this as opposed to handling this through the query based on the table.
Thoughts on any of the above or other approaches to getting the page #s “right”?
Thanks.
Fred