How set focus to subform

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".
 
M

Mr B

Try this for the syntax:

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

mscertified

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".
 
M

Mr B

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".
 
R

Richard Rost

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".
 

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