How set focus to subform

  • Thread starter Thread starter mscertified
  • Start date Start date
M

mscertified

When I click on a button on my main form I want to switch the focus to a
control on a subform. What is the syntax? I tried Me!mySubForm.Form.Setfocus
and it said 'Invalid method".
 
Try this for the syntax:

Forms![YourFormName]![YourSubFormName].Form![ControlName].SetFocus
 
Actually, all I had to code was:
Me!mySubForm.Setfocus

Mr B said:
Try this for the syntax:

Forms![YourFormName]![YourSubFormName].Form![ControlName].SetFocus

--
HTH

Mr B
askdoctoraccess dot com


mscertified said:
When I click on a button on my main form I want to switch the focus to a
control on a subform. What is the syntax? I tried Me!mySubForm.Form.Setfocus
and it said 'Invalid method".
 
The "Me" will work as long as your code in in the form in which the subform
is located, however, if the code in in a module or another form the formal
reference will be required.
--
HTH

Mr B
askdoctoraccess dot com


mscertified said:
Actually, all I had to code was:
Me!mySubForm.Setfocus

Mr B said:
Try this for the syntax:

Forms![YourFormName]![YourSubFormName].Form![ControlName].SetFocus

--
HTH

Mr B
askdoctoraccess dot com


mscertified said:
When I click on a button on my main form I want to switch the focus to a
control on a subform. What is the syntax? I tried Me!mySubForm.Form.Setfocus
and it said 'Invalid method".
 
You can also do it with two DoCmd.GoToControl statements... one to the
subform, and another to the specific control on the subform. Cheezy, but it
works.

Richard Rost
www.599cd.com



Mr B said:
The "Me" will work as long as your code in in the form in which the subform
is located, however, if the code in in a module or another form the formal
reference will be required.
--
HTH

Mr B
askdoctoraccess dot com


mscertified said:
Actually, all I had to code was:
Me!mySubForm.Setfocus

Mr B said:
Try this for the syntax:

Forms![YourFormName]![YourSubFormName].Form![ControlName].SetFocus

--
HTH

Mr B
askdoctoraccess dot com


:

When I click on a button on my main form I want to switch the focus to a
control on a subform. What is the syntax? I tried Me!mySubForm.Form.Setfocus
and it said 'Invalid method".
 
Back
Top