Results 1 to 4 of 4
  1. #1
    4 Star Lounger
    Join Date
    Oct 2002
    Location
    Sayre, Pennsylvania, USA
    Posts
    504
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Fooling Page Numbers (2000)

    I'd like to fudge page numbers until I can figure out a proper way to combine 2 reports. Basically I am now printing 2 reports separately. One report will always only be one page. The second report could at least be 2 but could vary as much as 30 or so. I want the first report to say Page 1 of XX and the xx comes from the number of pages from the second report plus the one from the first report and of course the second report starts with Page 2 of XX with the XX being the total number of pages from report 2 + 1 from the first report. Can this be done?
    Thanks,
    Deb

  2. #2
    Super Moderator
    Join Date
    Aug 2001
    Location
    Evergreen, CO, USA
    Posts
    6,624
    Thanks
    3
    Thanked 60 Times in 60 Posts

    Re: Fooling Page Numbers (2000)

    What you propose is either quite difficult or impossible as far as I can see. At best it would involve previewing the report and then looking at the result in code, but I'm not sure the total number of pages in a report is exposed in 2000. Then you would have to dynamically alter the report and add one to the total, put that on the first report, and then modify the second report to add one to the number of pages. An alternative might be to put a bogus first page on the second report, and then only print from pages 2 to XX. Then you could print it first to get the correct total number of pages, then print the first report and use a parameter in the data source to specify the number of pages (XX). Often a small amount of manual effort can simplify programming requirements considerably. Another possibility would be to export both reports to RTF, and then combine them in Word, but RTF imposes some pretty serious constraints. One way of combining two reports is to make both of them subreports on a single main report, and just not link them to any vaue on the main report - in effect the main report is unbound. Hope all this rambling helps.
    Wendell

  3. #3
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Fooling Page Numbers (2000)

    Apart from the ideas suggested by Wendell, you could do the following:

    - In a standard module (created by clicking New in the Modules section of the database window), declare a public variable, and create a public function:

    <code>Public intPages As Integer</code>

    <code>Public Function GetPages() As Integer</code>
    <code> GetPages = intPages</code>
    <code>End Function</code>

    - Open the second report in design view.
    - Set the control source for the text box in the report footer that should display the page number to

    <code>="Page " & ([Page]+1) & " of " & ([Pages]+1)</code>

    - Create an On Open event procedure for the report:

    <code>Private Report_Open(Cancel As Integer)</code>
    <code> intPages = 0</code>
    <code>End Sub</code>

    - Create an On Format event procedure for the page footer:

    <code>Private Sub PageFooterSection_Format(Cancel As Integer, FormatCount As Integer)</code>
    <code> intPages = Me.Pages + 1</code>
    <code>End Sub</code>

    - Close and save the second report.
    - Open the first report in design view.
    - Set the control source for the text box in the report footer that should display the page number to:

    <code>="Page 1 of " & GetPages()</code>

    - Close and save the first report.
    - Make sure that the second report gets viewed/printed before the first report. In code:

    <code>DoCmd.OpenReport "rptSecondReport", acViewNormal</code>
    <code>DoCmd.OpenReport "rptFirstReport", acViewNormal</code>

  4. #4
    4 Star Lounger
    Join Date
    Oct 2002
    Location
    Sayre, Pennsylvania, USA
    Posts
    504
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Fooling Page Numbers (2000)

    Thanks Hans & Wendell. I appreciate your help. I knew it would take some programming and also knew I had no chance of figuring it out. It's working. I want to combine the 2 reports but am having trouble with relationships which makes me think I have a design issue some where, so until I figure that out this will hold every one over.
    Thanks a bunch. You guys make me look good at work!
    <img src=/S/bravo.gif border=0 alt=bravo width=16 height=30>
    Deb

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •