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:
Your help is highly appreciated.
Regards,
qwerty70
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