master form sending sub-form messages??

  • Thread starter Thread starter dan
  • Start date Start date
D

dan

I have a master form and a sub-form. The sub-form
contains a tabbed menu. Depending on certain values in
the master form's current record, I want to hide certain
tabs in the sub-form.

I was thinking that, when the master form receives an
OnCurrent event, I can signal to the sub-form to alter its
tabs. However, I want to know what the best method of
doing this is. I don't want to use the Forms![sub-form]
notation as I may have two instances of the same form open.

Any ideas would be greatly welcomed.

Regards,

Dan.
 
Hi Dan,

I'm confused by this:
I don't want to use the Forms![sub-form]
notation as I may have two instances of the same form open.

If you are truly talking about a subform (a child form within a main form),
the reference is:

forms!frmMain.sfrmSubFormCtl.form.tabMyTab

If you have multiple instances of the subform on the mainform, each has a
unique subform control name, and you would just plug the correct names in to
the above in place of 'sfrmSubFormCtl'.

If you are talking about multiple instances of the main form (frmMain), then
you must already have an object variable that points to each instance. The
way you'd reference the subforms in this situation depends on how you're
storing the form variables.

--
Sandra Daigle
[Microsoft Access MVP]
For the benefit of others please post all replies to this newsgroup.

I have a master form and a sub-form. The sub-form
contains a tabbed menu. Depending on certain values in
the master form's current record, I want to hide certain
tabs in the sub-form.

I was thinking that, when the master form receives an
OnCurrent event, I can signal to the sub-form to alter its
tabs. However, I want to know what the best method of
doing this is. I don't want to use the Forms![sub-form]
notation as I may have two instances of the same form open.

Any ideas would be greatly welcomed.

Regards,

Dan.
 
Back
Top