From the last control on frmMain I would like the focus
to tab next to the first field of the subform on a tab
control with two tabs. I can't seem to get the syntax for
referencing controls on a page on a subform on a tab.
Forms!frmMain!????How do you refer to the tab control &
pages????subfrmMysub.form![Mycontrol].SetFocus
Help! Please!
To reference a control on a subform you make the reference via the form
object of the Subform control
Forms!frmMain.subfrmMySub.form.MyControl.SetFocus
me.subfrmMySub.form.MyControl.SetFocus
One of the keys to this is to understand that 'subfrmMySub' in the above
statement must be the name of the subform control on the main form. This may
or may not be the same name as the form object that is being used in the
ControlSource of the subform control. To be sure, click once on the subform,
then look at the name property of the control (under the Other tab).
Whatever you see there is what should be in the above reference.
Then when you reference the Form Property of the subform control, you get
access to the individual controls and properties of the form object itself.
If the code is in the class module of frmMain, you can (and should) use the
Me keyword instead of using the Forms!frmMain reference. This speeds things
up a tiny bit and it also makes it clear that what follows the Me keyword
belongs to the current form (and not another form floating around out
there).
--
Sandra Daigle
[Microsoft Access MVP]
For the benefit of others please post all replies to this newsgroup.
Forms!frmMain!SubformControl.Form! ....
should do.
--
HTH
Van T. Dinh
MVP (Access)
"SlowLearner" <kgai...@cox.net> wrote in message
news:0dc001c25e54$20ac45e0$39ef2ecf@TKMSFTNGXA08...
Joan Wild
Access MVP
"SlowLearner" <kgai...@cox.net> wrote in message
news:0dc001c25e54$20ac45e0$39ef2ecf@TKMSFTNGXA08...