Error is because the syntax is wrong, which is based on the hierarchy of related objects. Use the syntax of one of the following:
Code:
Forms("MainFormName").Controls("subformControlName").Form
Forms("MainFormName").Controls("subformControlName").Form
Either of those should get you to the subform level. After that, you either drill down further to form controls or just continue with form properties or methods. NOTE: subformControlName is the name of the control that contains the subform, which may or may not be the same name as the subform. Access has the tendency to name this the same, as well as name controls the same as the field they're bound to. Personally, I don't let that stand. Also, use your object names, not (e.g.) MainFormName.
Last edited by Micron; 06-20-2022 at 07:29 PM.
Reason: corrected references
The more we hear silence, the more we begin to think about our value in this universe.
Paraphrase of Professor Brian Cox.