Adding field from subreport to field in main report

G

Guest

Hi,

I have read lots of posts and tried some of them, but I cannot get it right.
I need help!
I have a main report (ReportTrial1) and a Sub-Report (ReportTrial3).
I need to add 2 fields: 1 located in the main form named ConsultID
(currency), the other field is located in the subreport: (ProfFeePrice):
currency.

The sub report is placed in the Detail section of the main report:
I have tried to put a text box called (txtSubTotal) in the detail section of
the main report with the following control source:
IIf([ReportTrial3].[Report].[HasData],
Nz([ReportTrial3].[Report].[ProfFeePrice],0),0)

I have then added another text box in the main report group footer:
=Sum([ConsultID]+[txtSubTotal])
Running sum property: Over All

The report just displays a blank page, I have the feeling that I have put
these txt boxes in the wring places. I really need some help and I will
appreciate any suggestions.

Chris.
 
M

Marshall Barton

Chris said:
I have read lots of posts and tried some of them, but I cannot get it right.
I need help!
I have a main report (ReportTrial1) and a Sub-Report (ReportTrial3).
I need to add 2 fields: 1 located in the main form named ConsultID
(currency), the other field is located in the subreport: (ProfFeePrice):
currency.

The sub report is placed in the Detail section of the main report:
I have tried to put a text box called (txtSubTotal) in the detail section of
the main report with the following control source:
IIf([ReportTrial3].[Report].[HasData],
Nz([ReportTrial3].[Report].[ProfFeePrice],0),0)

I have then added another text box in the main report group footer:
=Sum([ConsultID]+[txtSubTotal])
Running sum property: Over All

The report just displays a blank page, I have the feeling that I have put
these txt boxes in the wring places. I really need some help and I will
appreciate any suggestions.


I have no idea why the blank page, but your expression is
not going to work. The aggregate functions (Count, Sum.
etc) are only operate on fields in the report's record
source table/query. They are unaware of controls on the
report. This means that your Sum can not do what you were
hoping it would do.

Instead of of using =Sum([ConsultID]+[txtSubTotal]) in the
group footer, use the RunningSum property on the detail text
box. The group footer text box's expression would then be:
=[ConsultID]+[txtSubTotal]
(although I have no idea what ConsultID has to do with
anything). Remove the RunningSum property from this text
box since it's only used to display the group total.

Add another text box with the same expression to the group
footer with the RunningSum set to Over All to accumulate
the report's grand total.
 
G

Guest

Hi marshall,
Thanks a lot for the response. Sorry about the ConsultID field, it in fact
the ConsultFee field which is a currency field.
I'll try you suggestion, it sounds exactly what I needed.
Thanks a lot,
Chris.

Marshall Barton said:
Chris said:
I have read lots of posts and tried some of them, but I cannot get it right.
I need help!
I have a main report (ReportTrial1) and a Sub-Report (ReportTrial3).
I need to add 2 fields: 1 located in the main form named ConsultID
(currency), the other field is located in the subreport: (ProfFeePrice):
currency.

The sub report is placed in the Detail section of the main report:
I have tried to put a text box called (txtSubTotal) in the detail section of
the main report with the following control source:
IIf([ReportTrial3].[Report].[HasData],
Nz([ReportTrial3].[Report].[ProfFeePrice],0),0)

I have then added another text box in the main report group footer:
=Sum([ConsultID]+[txtSubTotal])
Running sum property: Over All

The report just displays a blank page, I have the feeling that I have put
these txt boxes in the wring places. I really need some help and I will
appreciate any suggestions.


I have no idea why the blank page, but your expression is
not going to work. The aggregate functions (Count, Sum.
etc) are only operate on fields in the report's record
source table/query. They are unaware of controls on the
report. This means that your Sum can not do what you were
hoping it would do.

Instead of of using =Sum([ConsultID]+[txtSubTotal]) in the
group footer, use the RunningSum property on the detail text
box. The group footer text box's expression would then be:
=[ConsultID]+[txtSubTotal]
(although I have no idea what ConsultID has to do with
anything). Remove the RunningSum property from this text
box since it's only used to display the group total.

Add another text box with the same expression to the group
footer with the RunningSum set to Over All to accumulate
the report's grand total.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top