Thistlestop
Technical User
On a report, one control is 'xxx'. It's any digit from 1 thru 6. I need to calculate the DIFFERENCE between the CURRENT value of xxx (current line on the report) and the PRIOR value (last line on the report). For example, if the current value is 5 and the prior value is 3, I want to show a 2 adjacent to the 5 (since the increase from 3 to 5 is 2).
I tried the following code but I can't get it to work. (I used MsgBox to test).
1. Is the line: txtDifference = xxx- ILast correct?
2. MsgBox does NOT show the correct values in xxx
3. Once I get this to work, HOW DO I DISPLAY THE txtDifference VALUE ON THE REPORT ITSELF?
Thanks, Mike
Private Sub Detail_Print(Cancel As Integer, PrintCount As Integer)
Dim ILast As Long
Dim txtDifference As Long
Dim xxx As Long
txtDifference = xxx- ILast
' I want to display txtDifference on the report now
ILast = xxx
' MsgBox xxx
' Set ILast to the current xxx
' When I get the NEXT xxx I then calculate the NEXT difference
End Sub
I tried the following code but I can't get it to work. (I used MsgBox to test).
1. Is the line: txtDifference = xxx- ILast correct?
2. MsgBox does NOT show the correct values in xxx
3. Once I get this to work, HOW DO I DISPLAY THE txtDifference VALUE ON THE REPORT ITSELF?
Thanks, Mike
Private Sub Detail_Print(Cancel As Integer, PrintCount As Integer)
Dim ILast As Long
Dim txtDifference As Long
Dim xxx As Long
txtDifference = xxx- ILast
' I want to display txtDifference on the report now
ILast = xxx
' MsgBox xxx
' Set ILast to the current xxx
' When I get the NEXT xxx I then calculate the NEXT difference
End Sub