views:

157

answers:

1

I am using MS Access 2003 and I have a form with two subforms (subform1 and subform2) which are not nested. They both display tabular data on them so they cannot be nested. I would like to change the recordsource on subform2 based on a value in the current record on subform1.

I have tried to put the code in the oncurrent event of subform1 but I cannot seem to refer to the recordsource in subform2 from subform1. From subform1 I have tried me.parent!subform2.form.recordsource but I get a runtime error ‘2455’ You have entered an expression that has an invalid reference to the property form/report.

Any ideas?

+1  A: 

Make sure that subform2 is the name of the subform control, not the form contained. While these usually have the same name, they can be different.

me.parent.subform2.form.recordsource

See http://www.mvps.org/access/forms/frm0031.htm

Remou
I'm afraid that this does not work. I still get 2455 "You entered an expression that has an invalid reference to the property form/report"The document in the link you gave has syntax for nested subforms but not for referring to a second non nested subform. Any more ideas?
Dkellygb