G
Guest
My setfocus code is not working.
There are 4 pieces ... 1 piece for On Exit property of "last field" in Main
Form ... 1 piece for On Exit property of "last field" in 1st Subform ... 1
piece for On Exit property of "last field" in 2nd Subform ... 1 piece for On
Exit property of "last field" in 3rd Subform.
Code is reproduced at bottom. Can anybody see what's wrong?
My Goal ... Tab thru all fields on Form. Form consists of Main Form with 3
Subforms. (The Main Form has a few fields, and each Subform has a few
fields.)
Problem #1 ... When I attempt to Tab from "last field" in 1st Subform to
"first field" in 2nd Subform, the cursor does "not" move to 2nd Subform.
Instead, it moves back to "first field" of 1st Subform.
Problem #2 ... When I attempt to Tab from "last field" in 2nd Subform to
"first field" in 3rd Subform, the cursor does "not" move to 3rd Subform.
Instead, it moves back to "first field" of 2nd Subform.
Exception to Problems ... When I Tab from "last field" in Main Form to
"first field" in 1st Subform, the Tab works. Likewise, when I Tab from "last
field" in 3rd Subform to "first field" in Main Form, the Tab works.
For Code Reference ... what follows are names of Main Form, Subforms, and
fields:
Main Form = BM_DataEntry ... first field = PageID ... last field = Link
1st Subform = Details_Subform ... first field = DetailID ... last field =
PageID
2nd Subform = SubjectHead_Subform ... first field = SubjectID ... last field
= PageID
3rd Subform = Author_Subform ... first field = AuthorID ... last field =
PageID
CODE ...
1.) Code for Tab from "last field" in Main Form to "first field" in 1st
Subform:
Private Sub Link_Exit(Cancel As Integer)
Forms![BM_DataEntry]![Details_Subform].Form![DetailID].SetFocus
End Sub
2.) Code for Tab from "last field" in 1st Subform to "first field" in 2nd
Subform:
Private Sub PageID_Exit(Cancel As Integer)
Forms![BM_DataEntry]![SubjectHead_Subform].Form![SubjectID].SetFocus
End Sub
3.) Code for Tab from "last field" in 2nd Subform to "first field" in 3rd
Subform:
Private Sub PageID_Exit(Cancel As Integer)
Forms![BM_DataEntry]![Author_Subform].Form![AuthorID].SetFocus
End Sub
4.) Code for Tab from "last field" in 3rd Subform to "first field" in Main
Subform:
Private Sub PageID_Exit(Cancel As Integer)
Forms![BM_DataEntry]![PageID].SetFocus
End Sub
There are 4 pieces ... 1 piece for On Exit property of "last field" in Main
Form ... 1 piece for On Exit property of "last field" in 1st Subform ... 1
piece for On Exit property of "last field" in 2nd Subform ... 1 piece for On
Exit property of "last field" in 3rd Subform.
Code is reproduced at bottom. Can anybody see what's wrong?
My Goal ... Tab thru all fields on Form. Form consists of Main Form with 3
Subforms. (The Main Form has a few fields, and each Subform has a few
fields.)
Problem #1 ... When I attempt to Tab from "last field" in 1st Subform to
"first field" in 2nd Subform, the cursor does "not" move to 2nd Subform.
Instead, it moves back to "first field" of 1st Subform.
Problem #2 ... When I attempt to Tab from "last field" in 2nd Subform to
"first field" in 3rd Subform, the cursor does "not" move to 3rd Subform.
Instead, it moves back to "first field" of 2nd Subform.
Exception to Problems ... When I Tab from "last field" in Main Form to
"first field" in 1st Subform, the Tab works. Likewise, when I Tab from "last
field" in 3rd Subform to "first field" in Main Form, the Tab works.
For Code Reference ... what follows are names of Main Form, Subforms, and
fields:
Main Form = BM_DataEntry ... first field = PageID ... last field = Link
1st Subform = Details_Subform ... first field = DetailID ... last field =
PageID
2nd Subform = SubjectHead_Subform ... first field = SubjectID ... last field
= PageID
3rd Subform = Author_Subform ... first field = AuthorID ... last field =
PageID
CODE ...
1.) Code for Tab from "last field" in Main Form to "first field" in 1st
Subform:
Private Sub Link_Exit(Cancel As Integer)
Forms![BM_DataEntry]![Details_Subform].Form![DetailID].SetFocus
End Sub
2.) Code for Tab from "last field" in 1st Subform to "first field" in 2nd
Subform:
Private Sub PageID_Exit(Cancel As Integer)
Forms![BM_DataEntry]![SubjectHead_Subform].Form![SubjectID].SetFocus
End Sub
3.) Code for Tab from "last field" in 2nd Subform to "first field" in 3rd
Subform:
Private Sub PageID_Exit(Cancel As Integer)
Forms![BM_DataEntry]![Author_Subform].Form![AuthorID].SetFocus
End Sub
4.) Code for Tab from "last field" in 3rd Subform to "first field" in Main
Subform:
Private Sub PageID_Exit(Cancel As Integer)
Forms![BM_DataEntry]![PageID].SetFocus
End Sub