Setting Focus on Subform

  • Thread starter Thread starter Lara
  • Start date Start date
L

Lara

I'm sure this is simple;I must be formatting this wrong.
I am just trying to get a form to set focus on a
particular control on a subform, when a certain button on
the main form is clicked, in VBA. It gives me the
error "Microsoft Access can't find the
form "Demographics2" referred to in a Macro expression or
Visual Basic Code". My format, according to the help
files:

forms!demographics2!company.setfocus

The form is enabled, and visible.
 
Lara,

Setting focus on a control on a subform from the main form is a two step
process. First you set the focus on the subform control then you set the focus
on the control. Example:
Me!NameOfSubformControl.Setfocus
Me!NameOfSubformControl!NameOfFieldOnSubform.Setfocus

Note that the subform control is not the name of the subform but the name of the
"White Box" for the subform that you see when you open the main form in design
view. Click anywhere on its border, open properties and get its name.
 
Thank you immensely!
-----Original Message-----
Lara,

Setting focus on a control on a subform from the main form is a two step
process. First you set the focus on the subform control then you set the focus
on the control. Example:
Me!NameOfSubformControl.Setfocus
Me!NameOfSubformControl!NameOfFieldOnSubform.Setfocus

Note that the subform control is not the name of the subform but the name of the
"White Box" for the subform that you see when you open the main form in design
view. Click anywhere on its border, open properties and get its name.


--
PC Datasheet
Your Resource For Help With Access, Excel And Word Applications
(e-mail address removed)
www.pcdatasheet.com








.
 
Back
Top