Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Report Footer Calculation 1

Status
Not open for further replies.

qwerty70

Technical User
Dec 13, 2005
73
GB
Dear All,

I have a report that shows a wrong calculation once it is printed. When I preview it, the calculation looks perfect.

I have 3 unbound textboxes on my report footer, these are:

txtTotalDoc, the control source is "=Count([DocNum])"
txtCountLatest
txtSuperseded, the control source is "=[txtTotalDoc]-[txtCountLatest]"

The calculation looks ok when I preview it; as an example:
txtTotalDoc = 7
txtCountLatest = 5
txtSuperseded = 2

But once it is printed, it looks like this:
txtTotalDoc = 7
txtCountLatest = 10
txtSuperseded = -3

Any idea why this is happening? Please help. Here's my code:


Code:
Option Compare Database
Private txtCountLatestx As Integer

Private Sub Detail_Print(Cancel As Integer, PrintCount As Integer)
   Dim Criteria As String
      
   Criteria = "[DocNum]='" & Me!DocNum & "'"
   
   If CipherRev(Me!RevNum) = DMax("Cipher", "qryMultiSearch_Incoming", Criteria) Then
      Me!RevNum.ForeColor = 255 'Red
   Else
      Me!RevNum.ForeColor = 16711680 'Blue
   End If

    'code to count the latest drawing only
    If Me!RevNum.ForeColor = 255 Then
        txtCountLatestx = txtCountLatestx + 1
    End If

End Sub

Private Sub Report_Open(Cancel As Integer)
    txtCountLatestx = 0
End Sub

Private Sub ReportFooter_Format(Cancel As Integer, FormatCount As Integer)
        Me!txtCountLatest = txtCountLatestx
End Sub

Your help is highly appreciated.

Regards,

qwerty70
 
You may try this:
Private Sub ReportFooter_Format(Cancel As Integer, FormatCount As Integer)
Me!txtCountLatest = txtCountLatestx
[!]txtCountLatestx = 0[/!]
End Sub

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
PHV, a million thanks to your unwavering support. It worked perfect.

regards,

qwerty70
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top