By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,209 Members | 1,092 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,209 IT Pros & Developers. It's quick & easy.

Referring to a subreport (Error 2455)

P: n/a
Hi,

I have a Report with a subreport, and I want to assign a value to the
control source of a control on the subreport depending on the value
given by the user in a separate form. Based on advice from the online
help and from other posts in this group, I wrote the following code
which is called on the On Open even of the main report. I have tried
several variations on this, which always result in the same error
message-

Run-time error 2455 'You entered an expression that has an invalid
reference to the property Form/Report.'

I have checked that the subreport name I am referring to is the
control name that appears in the main report and not the actual name
of the subreport.

THE OFFENDING CODE:
[Reports]![Insufficient Crew Report]![SubReport4 Basingstoke And
Deane].Report!TotalPercentOnRun.ControlSource = tempvalue

I hope that this makes sense to someone, I've run out of ideas!
Thanks in advance,
Kirsty
Nov 13 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
You can only set a report object's RecordSource property at run-time from
within the execution of its OnOpen event. Access initializes subreports
before parent reports, so the subreport's OnOpen event has already completed
by the time the main report's OnOpen event tries to set it.

What you have to do is have the Subreport set its own Recordsource property
from its own OnOpen event handler.

On 16 Dec 2004 06:54:46 -0800, kl******@hotmail.com (Kirsty Ryder) wrote:
Hi,

I have a Report with a subreport, and I want to assign a value to the
control source of a control on the subreport depending on the value
given by the user in a separate form. Based on advice from the online
help and from other posts in this group, I wrote the following code
which is called on the On Open even of the main report. I have tried
several variations on this, which always result in the same error
message-

Run-time error 2455 'You entered an expression that has an invalid
reference to the property Form/Report.'

I have checked that the subreport name I am referring to is the
control name that appears in the main report and not the actual name
of the subreport.

THE OFFENDING CODE:
[Reports]![Insufficient Crew Report]![SubReport4 Basingstoke And
Deane].Report!TotalPercentOnRun.ControlSource = tempvalue

I hope that this makes sense to someone, I've run out of ideas!
Thanks in advance,
Kirsty


Nov 13 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.