Subform on Form Page

K

krcmd1

What is the correct syntax for referencing a subform on a tab(page) on a form?

What about a field in the current record in a subform on a tab(page) on a form?


thanks

Ken
 
W

Wayne Morgan

The full path would be

Forms!frmNameOfMainForm!ctlNameOfSubformControl.Form!ctlNameOfControl

If the code is on the main form then Forms!frmNameOfMainForm can be replaced
with Me. The subform control is a control on the main form that acts as a
container for the subform. To get the name of this control, open the main
form in desgin mode, open the Properties sheet, click on the subform ONE
time. The Properties sheet should show the name of the subform control. If
you click a second time, you'll be in the subform and the Properties sheet
will show the name of the subform, not the control holding it.

Controls on a tab are refered to as if they were on the form itself.
 
A

Alphonse Giambrone

If referencing from code in the main form:
Me!yoursubform.Form
Me!yoursubform!yourcontrol

From elsewhere:
Forms!yourform!yoursubform.Form
Forms!yourform!yoursubform!yourcontrol
 
K

krcmd1

Thank you

Alphonse Giambrone said:
If referencing from code in the main form:
Me!yoursubform.Form
Me!yoursubform!yourcontrol

From elsewhere:
Forms!yourform!yoursubform.Form
Forms!yourform!yoursubform!yourcontrol
 
K

krcmd1

Thank you

Wayne Morgan said:
The full path would be

Forms!frmNameOfMainForm!ctlNameOfSubformControl.Form!ctlNameOfControl

If the code is on the main form then Forms!frmNameOfMainForm can be replaced
with Me. The subform control is a control on the main form that acts as a
container for the subform. To get the name of this control, open the main
form in desgin mode, open the Properties sheet, click on the subform ONE
time. The Properties sheet should show the name of the subform control. If
you click a second time, you'll be in the subform and the Properties sheet
will show the name of the subform, not the control holding it.

Controls on a tab are refered to as if they were on the form itself.
 

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