Passing subreport text box value to main report (1 Viewer)

TB11

Member
Local time
Today, 10:56
Joined
Jul 7, 2020
Messages
54
Hi. I keep getting errors when I try to pass the value of a text box on a subreport to the main report. (I'll need this value on another subreport.)

Main report is: r_Main

Control source of subreport is: Report.r_Main_subA

Text box on subreport is: TotalCosts

Can anyone help?

Thanks.
 

theDBguy

I’m here to help
Staff member
Local time
Today, 08:56
Joined
Oct 29, 2018
Messages
17,154
Have you tried something like?

=[SubReportControlName].Report.[TotalCosts]
 

TB11

Member
Local time
Today, 10:56
Joined
Jul 7, 2020
Messages
54
@theDBguy I checked for typos, I've copied the subform control and the text box name from the property sheets. I've also tried the expression builder, but I still get #Error
 

theDBguy

I’m here to help
Staff member
Local time
Today, 08:56
Joined
Oct 29, 2018
Messages
17,154
@theDBguy I checked for typos, I've copied the subform control and the text box name from the property sheets. I've also tried the expression builder, but I still get #Error
Can you post some screenshots showing the Properties of your controls? Since we cannot see what you're doing, you'll have to show it to us.
 

TB11

Member
Local time
Today, 10:56
Joined
Jul 7, 2020
Messages
54
@theDBguy thanks. I'm going to try on a simpler report. Maybe there is an issue with the report design
 

Gasman

Enthusiastic Amateur
Local time
Today, 16:56
Joined
Sep 21, 2011
Messages
9,314
Have you actually used that Report prefix?
 

Pat Hartman

Super Moderator
Staff member
Local time
Today, 11:56
Joined
Feb 19, 2002
Messages
33,746
What ROW of the subreport do you think you are addressing? It makes no sense to pull data from a single row and place it in the main report.

Reports work differently from forms. They are produced sequentially and I doubt that the subreport is loaded before the main report because reports are multi-page so you may not be able to reference anything in the subreport. With forms, you have ONE instance of the main form at a time and that is a different situation than what you have with a report. If what you are trying to get is totals from the subreport footer, that might be possible. Otherwise, you will need to use dLookup() or dSum() to get what you want. The first implies that you know the ID of the record you want to get data from. Keep in mind that domain functions are quite inefficient so they will slow down the report.
 

Users who are viewing this thread

Top Bottom