Referring to Subform in Visual Basic

M

Mandorallin

I have a form and in that form I have a subform. If a certain value (string)
is placed in a field in the SUBFORM, I need a tickbox to display "True" in
the FORM.
I don't know what to code in Visual basic to make it check the field in the
subform. If it were a field in the form, for example, I would write:
If Forms![FormName].[FieldName] = Value Then ....
What would I type if I need it to refer to a subform and not a form??? And
if possible be as simple as possible with me because I really am an amature
and don't understand the many words that are confusing me in the Access help.
Thankyou.
 
K

Ken Snell [MVP]

If Forms![FormName]![SubformName]![FieldName] = Value Then ....

Where SubformName is the name of the subform control (the control, on the
main form, that actually holds the subform object).
 
D

David C. Holley

[Forms]!myMainFormName.form!mySubformName![myField]
or
[Forms]!myMainFormName.form!mySubformName.propertyName

[Forms] and .form! are required, just substitute the approprate field
name or property as needed.
 
Top