开发者

Change a subform's recordsource from another subform in Access

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?


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

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜