Access Parent Subform's Record Source

Djblois

Registered User.
Local time
Today, 03:45
Joined
Jan 26, 2009
Messages
598
I am in subform A and I am trying to change the record source in subform B (they both have the same parent form) but I keep receiving this error:


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


These are the two ways I tried it and receiving the error in both cases:


Code:
Forms!frmDailyCheckReport.subfrmDailyCheckReportStops.Form.RecordSource = "qryDailyCheckReportStops"


Me.Parent.subfrmDailyCheckReportStopsPostponed.Form.RecordSource = "qryDailyCheckReportStops"
 
Either should work if this is a normal form/subform and not a Navigation Form.

I always name subform container different from object it holds, like ctrDetails.
 
Both look OK BUT you have used two different names for the subform control.
Which is the correct name for the subform control on the main form?

The best reference for this type of code is http://access.mvps.org/Access/forms/frm0031.htm
 
They are actually 2 different subforms that I need to change and I am trying both
 
Then it sounds like both subform control names may be incorrect. Unless as June suggest you have a navigation form
 
You entered an expression that has an invalid reference to the property form/Repor
Like Isladogs said the name of the subform controls are probably not the same as the source object subforms, thus the error. Click on the outside of the subform control to get its real name.

By default the subform control gets the same name as the source object (another dumb Access convention), but not always the case depending on how you add the subform control. Often it will be something like Child1, Child 2...
 

Users who are viewing this thread

Back
Top Bottom