Question : Calculated control error in Microsoft Access 2007 report

First time post on this type of site, so sorry if I'm less clear than regular users.
In Access 2007 I have a report [SR_TOT] that displays various numeric fields correctly.
In another report [SR_TOT_FJ] I'm trying to display some of the numeric fields from [SR_TOT].
In the first report [SR_TOT] I've named the required numeric fields e.g. [TOT_WNR].
In the second report [SR_TOT_FJ] I've created via Expression Builder =Reports![SR_TOT]![TOT_WNR] (when I click on OK Access puts square brackets around [Reports]).
This calculated control displays as #Name? when I open [SR_TOT_FJ].
I've browsed through other questions on your site but can't find an obvious answer to something that I intuitively feel has a simple answer.  Anything that's not simple is likely to be beyond me, sadly.  Please help?

Answer : Calculated control error in Microsoft Access 2007 report

You cannot reference a control in a closed report.
(If the reference report is opened first then the other report is opened then this will work.)

You have two options:

Use code to open the first report "Hidden" then open the other report.
  DoCmd.OpenReport "FirstReport", acViewPreview, , , acHidden
  DoCmd.OpenReport "SecondReport", acViewPreview
...then on the close event of the second report, also close the First Report.
  DoCmd.Close acReport, "FirstReport", acSaveNo

The other option is to simply base the second report on a query that includes fields from the first report's recordsource.
For example if the first report is of Customers and the second report is of Orders.
And you want to show other Customer info on the Orders report.
You would base the Orders Report on a query of the Customers table and the Orders table.
This is the standard way of doing this
(If I am understanding your issue correctly)

;-)

JeffCoachman

Random Solutions  
 
programming4us programming4us