syntax to refer to a control on a form's subform?

  • Thread starter Thread starter Craig Buchanan
  • Start date Start date
C

Craig Buchanan

What is the correct syntax to get reference a control, named txtName, that
is on a subform that has been added to a main form?

Thanks,

Craig
 
Craig Buchanan said:
What is the correct syntax to get reference a control, named txtName,
that is on a subform that has been added to a main form?

You need to get to the control by way of the subform control on the main
form. From outside the main form, you can write

Forms!MainFormName!SubformControlName!txtName

From the main form itself, you can shorten that to

Me!SubformControlName!txtName

In either case, you must use the name of the subform *control*, which
may or may not be the same as the name of the form object that is
displayed in that control.
 
Forms!<form name>!<subform control name on form>.Controls("<control
name>").Requery
 
Back
Top