Results 1 to 9 of 9
  1. #1
    4 Star Lounger
    Join Date
    Oct 2003
    Location
    Guelph, Ontario, Canada
    Posts
    428
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Totals show in Preview mode but not in Print mode (Access 2000 (all update

    Here is an interesting problem. The code below is designed to show totals in the Page Footer (the user wants them there rather than in the Report Footer). The code resets to 0 at the end of each page, and then gives a grand total at the end of all pages.

    The code works perfectly in PREVIEW mode. But when you Print, the totals, with the exception of the RunSumTotalPayments, don't show. (I can get all of the totals to print, if there is only 1 page...if I don't reset the values to 0...but this defeats the purpose where there are more than 1 page.

    Option Compare Database
    Option Explicit
    Dim x As Currency
    Dim y As Currency
    Dim z As Currency
    Dim i As Currency
    Dim h As Currency

    Private Sub PageFooterSection_Print(Cancel As Integer, PrintCount As Integer)
    PageSumPMT = RunSumPMT - x
    x = RunSumPMT
    PageSumCOPAY = RunSumCOPAY - y
    y = RunSumCOPAY
    PageSumADJ = RunSumADJ - z
    z = RunSumADJ
    PageSumDEDUCT = RunSumDeduct - i
    i = RunSumDeduct
    PageSumTotalPayments = RunSumTotalPayments - h
    h = RunSumTotalPayments

    End Sub

    Is there a way to fix this, so that the totals will show in both Preview and Print modes, as well as allow for one page or multiple pages?

    Thanks.

    Tom

  2. #2
    Gold Lounger
    Join Date
    Feb 2001
    Location
    Sint Niklaas, Belgium
    Posts
    2,778
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Totals show in Preview mode but not in Print mode (Access 2000 (all up

    Francois

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

    Re: Totals show in Preview mode but not in Print mode (Access 2000 (all up

    If they don't show in print, they may be outside the printable area of the paper. Try increasing the bottom margin, or increasing the space below the controls in the footer.

  4. #4
    4 Star Lounger
    Join Date
    Oct 2003
    Location
    Guelph, Ontario, Canada
    Posts
    428
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Totals show in Preview mode but not in Print mode (Access 2000 (all up

    Francois
    I'll take a look at that difference approach.
    Thanks.

    Tom

  5. #5
    4 Star Lounger
    Join Date
    Oct 2003
    Location
    Guelph, Ontario, Canada
    Posts
    428
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Totals show in Preview mode but not in Print mode (Access 2000 (all up

    Hans
    The problem isn't with the printable area. All of the blocks are there to contain the values, and there is other stuff printed below the information that "doesn't show."

    The pages in Preview and Print mode are identical. It's just that the values show in Preview mode but not in Print mode.

    If it was that the values are coming from a form that is being close prior to printing, I would understand, but this is not the case.

    Tom

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

    Re: Totals show in Preview mode but not in Print mode (Access 2000 (all up

    I'd try if the MSKB article that Francois referred to helps. If not, could you post a stripped down copy of your database? See <post#=401925>post 401925</post#> for instructions.

  7. #7
    4 Star Lounger
    Join Date
    Oct 2003
    Location
    Guelph, Ontario, Canada
    Posts
    428
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Totals show in Preview mode but not in Print mode (Access 2000 (all up

    Hans and Francois

    Thanks for your help already on this problem.
    Using the approach in the MSKB article, as suggested by Francois, I modified the code to suit my purpose. The code is posted between the dashed lines below.
    - - - - - - - - - - - -
    Option Compare Database
    Option Explicit
    Public PageSumPMT As Double
    Public PageSumCOPAY As Double
    Public PageSumADJ As Double
    Public PageSumDEDUCT As Double
    Public PageSumTOTAL As Double

    Private Sub Detail_Print(Cancel As Integer, FormatCount As Integer)
    PageSumPMT = PageSumPMT + Me.PMT
    PageSumCOPAY = PageSumCOPAY + Me.COPAY
    PageSumADJ = PageSumADJ + Me.ADJ
    PageSumDEDUCT = PageSumDEDUCT + Me.DEDUCT
    PageSumTOTAL = PageSumPMT + PageSumCOPAY + PageSumADJ + PageSumDEDUCT

    End Sub
    Private Sub PageHeaderSection_Format(Cancel As Integer, FormatCount As Integer)

    ' reset the counter for each new page

    PageSumPMT = 0
    PageSumCOPAY = 0
    PageSumADJ = 0
    PageSumDEDUCT = 0
    PageSumTOTAL = 0

    End Sub
    - - - - - - - - - -

    Now, the interesting (puzzling!) thing is this...
    1. When you first open the database, and try to run this report, you get prompted for 5 parameters - PageSumPMT, PageSumCOPAY, PageSumADJ, PageSumDEDUCT and PageSumTOTAL. If you click OK at each of the parameter prompts, the report produces properly.
    2. As long as the database remains open, you can run the report as many times as you wish, without being prompted for the 5 parameters.

    All of which leads me to 2 questions...
    (a) Why does this occur?
    ([img]/forums/images/smilies/cool.gif[/img] Is there a way to change the code so that the parameters don't pop up?

    Thanks.

    Tom

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

    Re: Totals show in Preview mode but not in Print mode (Access 2000 (all up

    (a) I don't know, it doesn't happen in my test database.
    ([img]/forums/images/smilies/cool.gif[/img] Try the following: clear the control source of the 5 text boxes in the page footer that display the page sum. Add lines to Detail_Print, substituting the correct names for the text boxes:

    Private Sub Detail_Print(Cancel As Integer, FormatCount As Integer)
    PageSumPMT = PageSumPMT + Me.PMT
    PageSumCOPAY = PageSumCOPAY + Me.COPAY
    PageSumADJ = PageSumADJ + Me.ADJ
    PageSumDEDUCT = PageSumDEDUCT + Me.DEDUCT
    PageSumTOTAL = PageSumPMT + PageSumCOPAY + PageSumADJ + PageSumDEDUCT
    Me.txtSumPMT = PageSumPMT
    Me.txtSumCOPAY = PageSumCOPAY
    Me.txtSumADJ = PageSumADJ
    Me.txtSumDEDUCT = PageSumDEDUCT
    Me.txtSumTOTAL = PageSumTOTAL
    End Sub

  9. #9
    4 Star Lounger
    Join Date
    Oct 2003
    Location
    Guelph, Ontario, Canada
    Posts
    428
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Totals show in Preview mode but not in Print mode (Access 2000 (all up

    Hans
    Thanks! That seems to have solved the problem.

    The problem occurring only opon when the database was opened was a puzzler. One of Access' deep mysteries, I guess.

    I still can't figure out why my original approach worked fine in Preview mode but not in Print mode...also a mystery.

    Anyway, thanks again.

    All the best.
    Tom

Posting Permissions

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