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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Report Calculation using PRIOR record on report

Status
Not open for further replies.

Thistlestop

Technical User
Oct 9, 2006
3
US
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). I inserted this into the Report's OnReport section in the Detail section containing my data.

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
 
I forgot to mention that I included this VBA code in the Detail section's OnReport event (my data is there).

Thanks, Mike
 
in which app ?

Rgds, Geoff

We could learn a lot from crayons. Some are sharp, some are pretty and some are dull. Some have weird names and all are different colours but they all live in the same box.

Please read FAQ222-2244 before you ask a question
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top