Share via

SetValue on a nested subform

Anonymous
2017-05-24T10:43:43+00:00

I am trying to set a value on a nested sub form using a setValue macro.  In the expression builder I can choose fields on the subform to set the value of, but It does not list any fields in the nested subform.  I have tried overcoming this by using the setValue macro to set the value of an unbound control on the subform, then planning to write another macro to set the value on the nested  subform as the value on the unbound control of the subform is updated, unfortunately setting the value of the unbound control does not seem to trigger an event that I can use activate the second macro. Can anybody suggest a way forward?

***Post moved by the moderator to the appropriate forum category.***

Microsoft 365 and Office | Access | For home | Windows

Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.

0 comments No comments

Answer accepted by question author

Anonymous
2017-05-24T11:33:56+00:00

...................but It does not list any fields in the nested subform.

Write the expression yourself.  Subforms are not members of the Forms collection, so the syntax to reference a control in a subform is:

Forms![ParentFormName]![SubformControlName].Form![ControlName]

Consequently to reference a nested subform the syntax is:

Forms![ParentFormName]![SubformControlName].Form![NestedSubformControlName].Form![ControlName]

Note that SubformControlName and NestedSubformControlName are the names of the controls in the parent and first subform's Controls collections which house the subforms.  The name might or might not be the same as its source form object.

Was this answer helpful?

1 person found this answer helpful.
0 comments No comments

1 additional answer

Sort by: Most helpful
  1. Anonymous
    2017-05-24T13:43:23+00:00

    Ken

    Thank you, it's now doing exactly what I wanted.

    Was this answer helpful?

    0 comments No comments