Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Report: page(s) Count 1

Status
Not open for further replies.

Finedean

MIS
May 4, 2006
80
US
Hi,
Can anyone help me on how to do the following:

I have a report grouped by Hospital name (total report 20 Pages).
Let say Page 1 for HopitalX, page 2 and 3 for HopspitalY Page 4 for HospitalZ and pages 5 to 20 for
HospitalT
I would like a query or table to list page numbers based on the report like this:

HospitalName Beg Page End Page
HospitalX 1 1
HospitalY 2 3
HospitalZ 4 4
HospitalT 5 20

Is it possible? Thanks in advance

Dean
 
Using the OnFormat event of the Heading for HospitalName would be the place to write [Page] to the "tblReportPageNumbers" table. All you need is the first page number of each section, and subtract one to update the previous HospitalName record in the table. Using the ReportFooter OnFormat event would allow you to capture the last page number used in your report.
HTH
Vic
 
VicRauch,
thank you for your reply. I did not get any answers so I started to wonder if this is can be done.

I am not sure I understand the whole process. Can you be more specific?

Dean
 
Your report is grouped by hospital name, so I assume you have a header section for hospital name. Therefore, you can look at the properties for that section of your report, and there you will find a tab for events. In the event for OnFormat, put a "[" then press Ctrl+F2 which will put you into the VBA Sub for the OnFormat event for this header section for Hospital Name.
Within this area, as long as you have Page being used in your report (I assume you do if you know which pages are the first pages for each hospital name) you can use [Page] and the "[" and "]" are necessary here to put the value of whatever page your report is currently printing into a table. If you don't know how to use VBA to add records to a table, that will have to been an additional lesson.

If this is still unclear, please let me know, and the more specific you are on your questions, the better I can answer them.

Vic
 
Hi Vic,
thanks again.

the problem I am facing is: how to use VBA to add records from a report to a table. in this case how to list the hospital names and pages into a table.

I added this: =[page] to onformat event for the hospital header section but how do i transfer it to a table?

I am familiar with how to use vba properties.

dean

 
Dean,
The onformat event within the properties page needs to be: "[Event Procedure]"
Then either click the button on the right hand side with the "..." on it, or press the key combination of Ctrl+F2 which will take you to the OnFormat event for your hospital name header within your report.

It is here, within VBA, you will do the updating of a table with the various page numbers.

This event that your code is going to go in will be called each time the heading for Hospital Name will be formatted for printing.

Check out faq222-1527 for examples on writing VBA code to update tables.

You will want to output the page "[Page]" number while the code is being executed during the OnFormat event for the heading of HospitalName.
 
Vic,
Thanks for your help and your patient. I will definitely use the vba examples.

dean
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top