Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Restricted application of Setfocus method? 2

Status
Not open for further replies.

Manuel10

Programmer
Nov 12, 2004
18
NL
Hi,
I notice that the SetFocus method only works when referring to a subform. Referring to a control in a subform, or to a subsubform (which is seen as a control in a subform), or to a control in a subsubform, etc. just isn't working.

So,
Me![Subform].SetFocus - Works!
But
Me![Subform].Form![Control].SetFocus - 'Does not work
Me![Subform].Form![Subsubform].SetFocus - 'Does not work
Me![Subform].Form![Subsubform].Form![Control].SetFocus - 'Does not work.
Me![Subform].Form![Subsubform].Form![Subsubsubform].SetFocus - 'Does not work

Am I correct in this? Or is there still a way to use SetFocus on a subform control?

Thanks for any insight and advice! Manuel.
 
is there still a way to use SetFocus on a subform control?
Yes, with 2 calls:
Me![Subform].SetFocus
Me![Subform].Form![Control].SetFocus

3 calls for a SubSubForm control:
Me![Subform].SetFocus
Me![Subform].Form![Subsubform].SetFocus
Me![Subform].Form![Subsubform].Form![Control].SetFocus

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
How are ya Manuel10 . . . . .

When setting focus to a subform control, setfocus has to be performed twice . . . once for the subform and again for the control.
Code:
[blue]Me!subFormName.SetFocus
Me!subFormName.Form!CtlName.SetFocus[/blue]

Calvin.gif
See Ya! . . . . . .
 
Hi PH and AceMan,

It works! It works! It works!
I have been testing, trying and looking for months (not constantly off course) for this solution. Somehow never been able to find it anywhere on the internet, forum, etc.

This is really a great help!
Thanks very much!
Manuel.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top