Results 1 to 7 of 7
  1. #1
    bamski92 is offline Novice
    Windows 10 Access 2007
    Join Date
    May 2023
    Location
    Pennsylvania, US
    Posts
    4

    Is there a way to show a total calculated in the details section in the header?

    Hello, im very new to using access and have been getting by with examples and trial and error so far but i cant figure this out.


    I'm calculating the page total in the details section and I would like to have it shown in the header also.

    The code for my report is:

    "Option Explicit

    Dim curTotal As Currency

    Private Sub Detail_Print(Cancel As Integer, PrintCount As Integer)

    If PrintCount = 1 Then curTotal = curTotal + Me.rcrdAmount

    End Sub

    Private Sub PageFooterSection_Format(Cancel As Integer, FormatCount As Integer)

    Me.pgTotal = curTotal

    End Sub

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

    curTotal = 0

    End Sub"

    I was trying to reference pgTotal as the source for an unbounded text box in the header but since the header prints first it prints the first pages total on the second pages header.

    Is it possible to do what I'm trying to do?

  2. #2
    Bob Fitz's Avatar
    Bob Fitz is offline Access Developer
    Windows 10 Access 2016
    Join Date
    May 2011
    Location
    Essex UK
    Posts
    3,535
    Try using the OnFormat event rather that the OnPrint event.
    If this helped, please click the star at the bottom left of this posting and add to my reputation . Many thanks.
    Bob Fitzpatrick

  3. #3
    bamski92 is offline Novice
    Windows 10 Access 2007
    Join Date
    May 2023
    Location
    Pennsylvania, US
    Posts
    4
    I tried using the OnFormat event and it doesn't seem to have changed anything.

  4. #4
    Bob Fitz's Avatar
    Bob Fitz is offline Access Developer
    Windows 10 Access 2016
    Join Date
    May 2011
    Location
    Essex UK
    Posts
    3,535
    can you post a copy o the db
    If this helped, please click the star at the bottom left of this posting and add to my reputation . Many thanks.
    Bob Fitzpatrick

  5. #5
    bamski92 is offline Novice
    Windows 10 Access 2007
    Join Date
    May 2023
    Location
    Pennsylvania, US
    Posts
    4
    Sorry, the database I'm working on isn't mine so I recreated the parts I'm working with that are giving me trouble.
    Attached Files Attached Files

  6. #6
    Bob Fitz's Avatar
    Bob Fitz is offline Access Developer
    Windows 10 Access 2016
    Join Date
    May 2011
    Location
    Essex UK
    Posts
    3,535
    Quote Originally Posted by bamski92 View Post
    Sorry, the database I'm working on isn't mine so I recreated the parts I'm working with that are giving me trouble.
    Try the attached db. Post back with any questions you may have.
    Attached Files Attached Files
    If this helped, please click the star at the bottom left of this posting and add to my reputation . Many thanks.
    Bob Fitzpatrick

  7. #7
    bamski92 is offline Novice
    Windows 10 Access 2007
    Join Date
    May 2023
    Location
    Pennsylvania, US
    Posts
    4
    Apologies, I didn't have enough data in the table to properly show the problem I'm trying to solve.
    Additionally I was missing a command line for the button on the form.
    Attached Files Attached Files

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 2
    Last Post: 06-26-2021, 09:32 PM
  2. Replies: 7
    Last Post: 04-16-2018, 07:43 PM
  3. Replies: 3
    Last Post: 12-01-2017, 12:52 PM
  4. Replies: 6
    Last Post: 03-26-2013, 12:17 PM
  5. Replies: 26
    Last Post: 11-06-2009, 10:16 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums