Answered by:
Help with navigation forms and tab between subforms

Question
-
Hello Everyone I hope everyone is staying warm. Can someone help me again on this brain teaser and I know it is something obvious I am missing. I have created a Horizontal
Hello Everyone I hope everyone is staying warm. Can someone help me again on this brain teaser and I know it is something obvious I am missing. I have created a Horizontal Navigation form. That form is named for the sake of this discussion AjaxCo. I have two sub-forms within this navigation form are (Employees) and other named (Clients).
What I would like to do is as I tab through first tab form (Employees) when I lose focus on field named Spouse. I want to be able to automatically jump to next sub-form within this navigation form which is entitled (Clients) and regain tab focus on first field in (Clients) which is entitled FirstName.
I have placed the following code in First SubForm (Employees) field Spouse lost focus event
Private Sub Spouse_LostFocus()
Me. AjaxCo.SetFocus
Me. AjaxCo!Clients.SetFocus
Me. AjaxCo!Clients.Form! FirstName.SetFocus
End Sub
However, it is not triggering the desired response and getting errors. Does anyone have any ideas? I hope I explained it well. Once again like always Thanks everyone for their help and expertise I really appreciate it.
. That form is named for the sake of this discussion AjaxCo. I have two sub-forms within this navigation form are (Employees) and other named (Clients).
What I would like to do is as I tab through first tab form (Employees) when I lose focus on field named Spouse. I want to be able to automatically jump to next sub-form within this navigation form which is entitled (Clients) and regain tab focus on first field in (Clients) which is entitled FirstName.
I have placed the following code in First SubForm (Employees) field Spouse lost focus event
Private Sub Spouse_LostFocus()
Me. AjaxCo.SetFocus
Me. AjaxCo!Clients.SetFocus
Me. AjaxCo!Clients.Form! FirstName.SetFocus
End Sub
However, it is not triggering the desired response and getting errors. Does anyone have any ideas? I hope I explained it well. Once again like always Thanks everyone for their help and expertise I really appreciate it.
Friday, February 20, 2015 4:09 AM
Answers
-
Hi,
Just to make it clear... Do you use a navigation form or do you use a regular form which contains two subforms
You first have to set reference to the main for before you can set a reference to the other subform.
try this: Me.Parent.Clients.SetFocus
If you set the tab order to be the firstname to be the first field you should be good to go.
If you are using a 'real' navigation form you have to refer to the name of the navigation form first.
Maurice
When you see answers and helpful posts, please click Vote As Helpful, Propose As Answer, and/or Mark As Answer. Thank You
- Proposed as answer by Edward8520Microsoft contingent staff Monday, March 2, 2015 11:24 AM
- Marked as answer by Fei XueMicrosoft employee Monday, March 2, 2015 1:19 PM
Friday, February 20, 2015 12:56 PM -
in the OnExit event of the (Employees) Spouse field put:
Forms!MainFormName.ClientSubFormName.Form!ControlName.SetFocus
insert your actual object name where appropriate
- Proposed as answer by Edward8520Microsoft contingent staff Monday, March 2, 2015 11:24 AM
- Marked as answer by Fei XueMicrosoft employee Monday, March 2, 2015 1:19 PM
Friday, February 20, 2015 3:42 PM
All replies
-
Hi,
Just to make it clear... Do you use a navigation form or do you use a regular form which contains two subforms
You first have to set reference to the main for before you can set a reference to the other subform.
try this: Me.Parent.Clients.SetFocus
If you set the tab order to be the firstname to be the first field you should be good to go.
If you are using a 'real' navigation form you have to refer to the name of the navigation form first.
Maurice
When you see answers and helpful posts, please click Vote As Helpful, Propose As Answer, and/or Mark As Answer. Thank You
- Proposed as answer by Edward8520Microsoft contingent staff Monday, March 2, 2015 11:24 AM
- Marked as answer by Fei XueMicrosoft employee Monday, March 2, 2015 1:19 PM
Friday, February 20, 2015 12:56 PM -
in the OnExit event of the (Employees) Spouse field put:
Forms!MainFormName.ClientSubFormName.Form!ControlName.SetFocus
insert your actual object name where appropriate
- Proposed as answer by Edward8520Microsoft contingent staff Monday, March 2, 2015 11:24 AM
- Marked as answer by Fei XueMicrosoft employee Monday, March 2, 2015 1:19 PM
Friday, February 20, 2015 3:42 PM