problem moving focus to subform

ehdoh

Registered User.
Local time
Today, 10:46
Joined
Jun 24, 2003
Messages
58
I have a form with several subforms set up on a tab control. I am running into a problem where on every 2nd interview I go to enter, my 1st subform is skipped in the tabbing order and the user is jumped to the second subform (where they really needed to enter the first subform before moving to the second). So far this problem has not occurred when entering the first interview, but only when entering the second interview.

Here is the code being used to jump from the end of the form to the start of the first subform. The code below corresponds to two controls from the form, first from the very last control on the form (combo70) and then from the second to last control on the form (combo 71), whose answer determines whether to jump to the subform (DH_BevMeatSu) or to the last control on the form (combo70):

Private Sub Combo70_LostFocus()
Forms!DH_DairyForm.SetFocus
Forms!DH_DairyForm!DH_BevMeatSu.SetFocus
DoCmd.GoToControl "Combo14"
End Sub




Private Sub Combo71_LostFocus()
Select Case Me.Combo71
Case 1
DoCmd.GoToControl "Combo70"
Case "yes"
DoCmd.GoToControl "Combo70"
Case "y"
DoCmd.GoToControl "Combo70"
Case Else
Forms!DH_DairyForm.SetFocus
Forms!DH_DairyForm!DH_BevMeatSu.SetFocus
DoCmd.GoToControl "Combo14"
End Select
End Sub

I have tried using this code in both an AfterUpdate and LostFocus property, but both elicit the same problem. Any ideas how to cure this problem??

Thank you!
E.H.
 
EhDOH, I have programmed a simply method of switching to sub forms. I have also attached a working database that will allow the forms to change the focus to each sub form once the last field on the previous form looses the focus. Here is a sample code that gets me to the 2nd subform and set the focus on the 1st field of the 2nd form. To get to the 3rd form, simply change the frmSub2 to frmSub3 and teh txtSub2 to txtSub3. See the code behind each form for further details.

Private Sub cmbLast_LostFocus()
Forms!frmMaster.frmSub2.SetFocus
Forms!frmMaster.frmSub2.Form!txtSub2.SetFocus
End Sub
 

Attachments

Users who are viewing this thread

Back
Top Bottom