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

calculationfields on Main from not displyed subreports

Status
Not open for further replies.

kenneth72

Programmer
Dec 6, 2004
4
NO
Hi,

I have a report listing all my equipment, it has three subreports where the equipment are listed. I want to calculate total number of items, total weight, number of boxes in each subreport. The totals is linked to 3 fields on the main report. The problem is that occasionally there is subreports with no record which i creating an error in one of the calculations field and that gives an error on the corresponding main report field.

I have solved it by using hidden fields on the main report and using IIf(IsNull(....),0,result), but this is not a good way of doing it.
The other way is using Dsum, Dcount, Dmax etc but it's not recomended because it's slows the operation (?).

I have tried open_form event, but that is put in action before any records are calculated. And the active event makes it run everytime the report get active.

What is the best way of solving this? I have tried searching the forum, but I can't really find a good solution.

--kenneth
 
what you could do is in the format event of the main form calculate the totals using SQL statements against the data and manually add totals to unbound textboxes.

This is a bit messy but will work.
 
HAve you tried to play with the Nz function ?

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
I have nisspelled, It is a report.

And yes i have tried with the NZ function. But I got it working and I will just leave as is by now. There is other stuff that has higher priority. THX anyway

--kenneth
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top