Problem with getting calculated field in Report (1 Viewer)

jukus

Registered User.
Local time
Today, 16:57
Joined
Jan 9, 2008
Messages
52
I have a report with a subreport.

The Report is called Invoices and the subReport is called Purchases.

In the subreport I have a filed that shows Amount. It can contain several rows if there were more than one purchase. so in the subreport footer I have a text box with control source =Sum ([Amount])

Works great.

Also in the main reprot I have a text box with control source =[WorkHours]*[BillingRate]

This is fine.

The problem I am having is I want to now add the totals from the sub report and the report. I realize I cannot use the text boxes with the calculations because they are not stored. I have tried setting the control source with functions but to no avail. Every time it asks me to key in an amount instead of performing the calculation.

My question is how can I get these to add together. I have tried =Sum(Sum([WorkHours]*[BillingRate],(Sum([Purchases].[Amount]))))

But everytime it asks me something like enter Purchases.Amount

Any help is greatlt appreciated.

Thanks
 

SamDeMan

Registered User.
Local time
Today, 16:57
Joined
Aug 22, 2005
Messages
182
i am not sure if there is a way to do this without vba. but if you write vba, you can have a global variable store the data when it is produced on the subreport and then add it with the total of the report. i have not tested this, but it should work.
 

jukus

Registered User.
Local time
Today, 16:57
Joined
Jan 9, 2008
Messages
52
Very new to creating databases so VBA is new to me also. Wouldn't have a clue where to start. I will look into find some code for storing the value.

Thank you for the assistance.
 

jukus

Registered User.
Local time
Today, 16:57
Joined
Jan 9, 2008
Messages
52
HasData seemed to work for this.

Here is what I used, in case someone else has the problem.
In the control soure for text box I used this =(IIF([PURCHASES].Report.HasData,[PURCHASES].Report.[Text8],0)+([WorkHours]*[BillingRate]))

PURCHASE IS THE subreport Text 8 is the box in the subreport that contains my sum of the amounts in the subreport. WorkHours and BillingRate are the field in my main report.

Thank for everyones help.
It is working for all of my sample data
 

Users who are viewing this thread

Top Bottom