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

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
 
D

Dirk Goldgar

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.
 
C

Craig Buchanan

Forms!<form name>!<subform control name on form>.Controls("<control
name>").Requery
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top