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

Error on Calculated field in print only

Status
Not open for further replies.

WhiteZiggy

Programmer
Jan 22, 2003
85
US
Help...

I have a field, totaldollars. It is a sum of all credits minus the debits. This is done during the onformat property of the detail. I Then set a text box to the number. At the group header i reset the number to 0. I have the variable declared and everything looks great, until I print it. Then the variable seems to double. But only the printed version. The onscreen version is right.


Any ideas??
 
Why are you using code? Can't you set the control source to an expression without using code? I have created hundreds of reports and never had to use code to create totals.

Duane
MS Access MVP
Find out how to get great answers faq219-2884.
 
There is no source. I add all where credit = CR and deduct all where credit = db.I could set 2 boxes and then another to the sum of the 2. But I want to get it working first, before I "hack" a solution. :)

If you have never used code you haven't used 1/2 of what you can do with the reports.

Thanks,
Jeremy
 
WhiteZiggy,
I have used code in reports:

To total a field [Amount] for all the records in a group or report footer where the field [Credit] = "CR" you don't need any code. Use an expression in a control source like:
=Sum(Abs([Credit] = "CR") * [Amount])
to get the debits
=Sum(Abs([Credit] = "DB") * [Amount])

The main point of my first reply is that too many novice to intermediate (and even advanced users) try to use code where simple expressions and SQL will work much more efficiently and accurately. If I missed your requirement for totalling then please reply back.



Duane
MS Access MVP
Find out how to get great answers faq219-2884.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top