468,301 Members | 1,526 Online

# Calculating the difference between two values

I have a table with two fields, txtvalue (a number field) and txtmonth ( a
date/time field). I want to create a report that shows the difference in
value between the value in txtvalue in one value of txtmonth and the value
of txtvalue in another value of txtmonth and the percentage increase . For
example if I have the value 1000 in 30/03/03 and the value 1100 in 30/03/04
How do I calculate the difference as 100 and the increase as 10%. I want to
do this in a report.
TIA
Tony Williams

Nov 13 '05 #1
1 3657

Not sure if I understand your question correctly, but I think your question
should / could be solved by programming stuff behind your report.

Add (global) variables to the code, and initialise it in the Header_format
section. In the Detail_format section, you can calculate the differences and
the % increase, and put this value in the report (make an unbound control
for that). Also, store the new value in the variable for calculating the
next one.

Be aware of funny things happening in the 'retreat' section. Here you need
to do something in reverse, or otherwise you'll get wrong results.

For understanding exactely how this works, create a report (using the
wizard) based on a cross-tab query. This report has no fixed columns, but
columns depending on the contents of the database. In such a report the
values on the page are filled using code, and that gives an excellent
opportunity to see what's happening and how you should go about using that

Alternatively, you can try and create a query that outputs two (following)
records of the same table, and have the increases calculated by the query,
but I'm not sure which is the easier of the two approaches.

Good luck,

Bass Hartkamp.

"Tony Williams" <tw@tcpinvalid.com> wrote in message
news:cp**********@titan.btinternet.com...
I have a table with two fields, txtvalue (a number field) and txtmonth ( a
date/time field). I want to create a report that shows the difference in
value between the value in txtvalue in one value of txtmonth and the value
of txtvalue in another value of txtmonth and the percentage increase . For
example if I have the value 1000 in 30/03/03 and the value 1100 in 30/03/04 How do I calculate the difference as 100 and the increase as 10%. I want to do this in a report.
TIA
Tony Williams

Nov 13 '05 #2

### This discussion thread is closed

Replies have been disabled for this discussion.