Sorry, but no.
First of all, it's important to distinguish between the name of the
control
that holds the subform and the name of the form that's being used as a
subform.
Let's assume you've got a form ParentForm and a form SubForm. If you drag
SubForm onto ParentForm to create the subform, the subform container will
usually be named SubForm (unless, of course, there's already a control
named
SubForm on ParentForm). On the other hand, if you select the subform
control
from the tool box, draw it on ParentForm and then populate the properties
of
that control (either using the wizard or filling them in manually), the
subform control will be named something like Child0 (the number 0 will
change). When you're referring to subforms, you always need to use the
name
of the control.
Since you're referring to a control on the parent form, you need to look
at
the Form property of that control to look at controls on the subform.
That means you probably need:
[Forms]![employees]![records].Form![Date].Form![dept].Form![MyComboBox]
However, I don't understand what scubadiver means by point 3 ("Records"
consists of a main form called "Date"). Perhaps the subform control on
the
main form ("employees") is named "records", and it uses "Date" as its
form.
That would mean that you wouldn't need that reference to Date above (it's
what pointed to by the Form property of the records control):
[Forms]![employees]![records].Form![dept].Form![MyComboBox]
Provided you remember that when it's referring to Subform1 and Subform2,
it's talking about the subform control name,
http://www.mvps.org/access/forms/frm0031.htm at "The Access Web" provides
a
good summary.
--
Doug Steele, Microsoft Access MVP
(no e-mails, please!)
KARL DEWEY said:
Your post says you have four layers of forms-subforms. I thought
Access only
could handle three.
Ok, use this then --
[Forms]![employees]![records]![Date]![dept]![dept]
By the way you should not use "date" as it is a reserved word in
Access.
:
At long last (and after losing a few brain cells) I am sure I have
the form
the way I would like it.
As I say in my second reply, I have a form with a subform which, in turn, is
inserted into a "top level" form
1) The top level form is called "employees"
2) The subform within "employees" is called "records"
3) "Records" consists of a main form called "Date"
4) "Date" has a subform called "dept"
??????
My cascading combo box is in "dept" and I would like to be advised on the
controlsource code!
Cheers!
:
Yep! Like this --
[Forms]![MainFormName]![SubFormName]![ControlName]
:
I have a cascading combo box on a subform. When I open the main
form I get an
"enter parameter value" message.
Do I have to reference the main form as well the sub form?