Change the source of subform entries from another subform in Access

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

I tried to put the code in the oncurrent event for subform1, but I cannot reference the source of the record in subform2 from subform1. From subform1 I tried me.parent! Subform2.form.recordsource, but I get a '2455 runtime error. You entered an expression that has an invalid link to the form / report of the property.

Any ideas?

+4
source share
1 answer

Make sure subform2 is the name of the subform control, not the form containing it. Although they usually have the same name, they can be different.

me.parent.subform2.form.recordsource 

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

+3
source

Source: https://habr.com/ru/post/1304656/


All Articles