Results 1 to 7 of 7
  1. #1
    4 Star Lounger
    Join Date
    Feb 2001
    Location
    Gillingham, Kent, England
    Posts
    511
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Page number reset (Access 97 SR2)

    I have a report which is grouped on establishmentID, each group has varying amounts of data and can go onto differing numbers of pages. Is there a way to reset the page numbers, so the first establishment prints "page 1 of 4" and the next prints "page 1 of 3" etc? Also, is there then a way to set the forcenewpage setting if the record is an even number as the report needs to be duplexed? I looked for a me.forcenewpage = true setting, but couldn't find one.

    Any help would be much appreciated.

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

    Re: Page number reset (Access 97 SR2)

    <P ID="edit" class=small>Edited by HansV on 28-Jun-02 13:09.</P>Hi Phil,

    It's easy to reset the page number. Create an event handler for the OnFormat event of the group header. Put in the instruction

    Page = 1

    (Alternatively, you can put Page = 0 in the OnFormat of the group footer, I think)

    Calculating the number of pages in a group is a lot more work. Microsoft has an example for Access 2 that should still work. I haven't tested it, so I can't tell you if it needs to be adapted for Access 97. It involves a temporary table to hold the number of pages for each group. See Q131937.

    BTW, ForceNewPage is a property of a section, not of the report as a whole. It doesn't reset the page number, but forces a page break before and/or after a section. You can set it to
    0 = none (default)
    1 = Before section
    2 = After section
    3 = Before and after section

    Regards,
    Hans

  3. #3
    4 Star Lounger
    Join Date
    Feb 2001
    Location
    Gillingham, Kent, England
    Posts
    511
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Page number reset (Access 97 SR2)

    Shortly after posting I did think of a way around the problem... which was to print from a button on a form. i.e. Select the recordset, move to the first record and print, 2nd record and print etc. Sending many jobs to the printer instead of just one.... which has fixed all of my problems... AND CREATED A NEW ONE!!!

    I've seen duplexing set up through code before but can't remember how to do it.

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

    Re: Page number reset (Access 97 SR2)

    If your printer supports duplexing, you should be able to set it by clicking the Properties button in the File/Print dialog. In code, you'd need the PrtDevMode property of the report. I can't help you there. See the online help.

    If you want to print even and odd pages separately, you can do this by making a form that gives the user the option to print only even or odd pages. In the OnPrint event of the detail section of the report, put code like this:

    Private Sub Detail_Print(Cancel As Integer, PrintCount As Integer)
    If (Forms!frmOddEven!PrintPages = "Even pages") And (Page Mod 2 = 1) Then
    Cancel = True
    ElseIf (Forms!frmOddEven!PrintPages = "Odd pages") And (Page Mod 2 = 0) Then
    Cancel = True
    End If
    End Sub

    (PrintPages is a combo box on the form frmOddEven with two items: Even pages and Odd pages)

    The Rptsmp97 database made available by Microsoft here has an example of this.

  5. #5
    4 Star Lounger
    Join Date
    Feb 2001
    Location
    Gillingham, Kent, England
    Posts
    511
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Page number reset (Access 97 SR2)

    Thanks for the tip Hans.

    If I went to file/print and selected Duplexing, then closed the box and clicked on the print button on my form, would it still pick up the duplexing previously set?

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

    Re: Page number reset (Access 97 SR2)

    I think it's best to experiment yourself. I've found that printing varies between environments, so even if it worked for me, it wouldn't guarantee that it would work for you.

    If necessary, you can display the report in print preview and then the print dialog:
    RunCommand acCmdPrint

  7. #7
    4 Star Lounger
    Join Date
    Feb 2001
    Location
    Gillingham, Kent, England
    Posts
    511
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Page number reset (Access 97 SR2)

    The main reason I got a bit lazy and asked instead of trying it myself is that, i'm working in Bromely and the printer in question is in Rochester. When I think I have a workaround I'll need to talk somebody throuugh running the report. It was one of those rush jobs that if you'd actually stopped and thought about things before diving in, it would have made the task so much easier!

Posting Permissions

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