form/subform problem

G

george

Hi to all,

I have a form fsubC with two combo boxes on it, cbo1 and
cbo2. In cbo2 there is a third column "ParentID" with a
filter Forms!fsubC!cbo1.value used to filter the list of
the cbo2 to correspond with the value already choosen for
cbo1. The form fsubC works fine by itself.

I also have a main form, frmA with a subform on it named
fsubB. The sourceobject for fsubB is fsubC.

The problem is that when I try to open frmA I get I
message asking me a value for "Forms!fsubC!cbo1.value".
What could be the problem? Why fsubC works fine by itself
but doen't work when it serves as a subform on another
form?

thanks in advance, george
 
S

Sandra Daigle

A subform is not open by itself - it is only open indirectly through the
subform control on the main form. So to reference a control on the subform,
you must also reference the subform control. With the following:


Main Form: named frmMain
subform control: named sfrmSub1
control on the subform: named txtMyControl


then from a query the correct reference to this control would be:


Forms!frmMain.form!sfrmSub1!tx­tMyControl

(The value property is not required)

Note that 'sfrmSub1' must be the name of the subform control on the main
form. This is not necessarily the same as the name of the form object that
is referenced in the ControlSource of the subform control. To be sure, open
the main form and click once on the subform then check the name property
under the Other tab. Whatever you find there is what belongs in place of
sfrmSub1.
 

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