Yesterday, a form/subform that worked well for me for a long time suddenly started throwing Error 2455: You entered an expression that has an invalid reference to the property Form/Report.
Below is my diagnosis of the problem. It feels like a bug.
My question is: Have any of you ever seen this? If you are interested, could you try to duplicate the problem, and let me know what you find?
The Problem:
After lots of experimentation, I narrowed it down to this:
My Workaround: Always ensure that at least part of the form's Detail section is visible in the SubForm control. Either:
Can you duplicate this? This is weird, so I would like some independent confirmation of this problem. So, please, if you have a little time, try these steps:
My 'grandchild' forms have no RecordSource when loaded. The recordsource is set in code after the parent/child forms load.
Please, indicate the version of Access you are running, and what results you get. I'm running Access Version 14.0.7128.5000, which seems pretty up-to-date.
Even though this is an old thread and the answer for OP was most certainly something else, I share this in hope it will help shed some light for others who have stumbeld on the "Error 2455: You entered an expression that has an invalid reference to the property Form/Report". Which may be pretty confusing and occure quite far from the actual cause of the error.
Happened to me today on Access 2016. While making some changes to a project, one of the forms started suddenly throwing Error 2455 in its Form_Load() event containing a single line of code:
Private Sub Form_Load()
Set mevtReferenceToSubform = Me.frmASubform.Form
End Sub
As pointed out in stackoverflow.com/questions/5023631/... in the comments to the question:
"Controls bound to the recordsource of the parent form (including subforms with LinkChild/LinkMaster properties) do not load when there are no records."
Apparently the same goes for an unbound subform aswell. The subforms '.Form' property will not be accessible from its parent form if the parent form's RecordSource query does not return any records!
In my case the culprit turned out to be a TempVar declaration which I had replaced with another solution, elswhere in the code. But had failed to notice that the removed TempVar was even used by the now failing parent form's query, which didn't return any results...
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With