Results 1 to 6 of 6
  1. #1
    Join Date
    May 2004
    Posts
    3

    Unanswered: Trouble printing access report valuesX2

    I have a problem printing out my Access report here is the code that I inserted to calculate the values I need. When I preview the report everything is fine, but when I print the report the values are multiplied by 2. How can I fix this?

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

    Static dCount As Integer
    Static dTotal As Integer
    Static dAvg As Double


    dTotal = dTotal + Me.CT
    dCount = dCount + 1

    Me.Text50 = dTotal
    dAvg = dTotal / Me.hrsWorked

    Me.Text73 = dAvg


    End Sub

  2. #2
    Join Date
    Oct 2003
    Posts
    66
    Not sure why it is doubling you resutl in the first place.....
    but how about dividing the result by 2?

  3. #3
    Join Date
    May 2004
    Posts
    3

    Printing X2

    I tried that, but the data in the report would be divided by 2 and the printed report would be the real calculated awnser. I would like the data to match both in the report and the printout. Thx.
    Last edited by djmor; 05-06-04 at 17:29. Reason: typo

  4. #4
    Join Date
    Oct 2003
    Location
    Ger
    Posts
    1,969
    Provided Answers: 1
    Why do you use Static variables? Do you intend to retain their values?

  5. #5
    Join Date
    May 2004
    Posts
    3

    Static Variables

    If I Dim the variables the formulas don't work.

  6. #6
    Join Date
    Sep 2003
    Location
    MI
    Posts
    3,713
    Quote Originally Posted by djmor
    I have a problem printing out my Access report here is the code that I inserted to calculate the values I need. When I preview the report everything is fine, but when I print the report the values are multiplied by 2. How can I fix this?

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

    Static dCount As Integer
    Static dTotal As Integer
    Static dAvg As Double


    dTotal = dTotal + Me.CT
    dCount = dCount + 1

    Me.Text50 = dTotal
    dAvg = dTotal / Me.hrsWorked

    Me.Text73 = dAvg


    End Sub
    Try dimming your variables OUTSIDE of the detail section ... Make them global to the report and initialize them on your Report_Open method ... They should work just fine.
    Back to Access ... ADO is not the way to go for speed ...

Posting Permissions

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