Syntax For Calling a Controls in Embeded Subforms

R

Robbie Baquiran

Example:
Mainform
SubForm1
SubForm1A
txtBox
SubForm2
SubForm2A
listbox
SubForm2B
combobox

What would be the correct syntax for referencing the combobox in SubForm2B?
Using the build tool, it tells me
"[Mainform].Form![SubForm2].Form![SubForm2B].Form![combobox]" which doesn't
work :\

Any help appreciated!
Thanks in Advance
 
D

Dirk Goldgar

Robbie Baquiran said:
Example:
Mainform
SubForm1
SubForm1A
txtBox
SubForm2
SubForm2A
listbox
SubForm2B
combobox

What would be the correct syntax for referencing the combobox in
SubForm2B? Using the build tool, it tells me
"[Mainform].Form![SubForm2].Form![SubForm2B].Form![combobox]" which
doesn't work :\

That syntax appears to be correct, except that ...

[MainForm].Form

.... must be an object reference to the form, which could be either

Forms![MainForm].Form

(if the reference is being made anywhere but on [MainForm] itself), or

Me

(if the reference is being made in code on [MainForm] itself), or

[Form]

(if the reference is being made as part of the controlsource of a
control on [MainForm] itself).

That may well be the source of the problem you're having.

You must also distinguish between the names of the subform *controls*
(the controls that provide the window on their parent forms to display
another form object) and the names of the form objects being displayed
by those controls. In subform references, it's the name of the subform
*control* you have to use, which may or may not be the same as the name
of the form that is its Source Object.
 

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