4
votes

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
Is the subform1 open? I don't think you can refer to anything in a form (code or data values) if that form is not currently open.SandPiper

1 Answers

3
votes

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