I have looked at a bunch of posts and tried to figure this one out myself, I'm sorry. I have a main form, a tab control and subforms on the tab control. I am using the following to get from the last field on the main form to the first subform in the first tab of the tab control:
Private Sub HouseholdWarnings_Instructions_AfterUpdate()
Forms![Main]![ClientReferralInfo].SetFocus
Forms![Main]![ClientReferralInfo].Form![Medicaid#].SetFocus
End Sub
works fine.
Then I am using the following to move from the last field of the 1st subform to the first field in the 2nd tab (which also contains a subform):
Private Sub InstallDate_KeyDown(KeyCode As Integer, Shift As Integer)
If Shift = 0 Then
If KeyCode = 9 Or KeyCode = 39 Then
Me.Parent!MedicalInfo.SetFocus
Me.Parent!MedicalInfo.Form![DrugAllergies].SetFocus
End If
End If
End Sub
It goes to the form, but the cursor is in the field AFTER the DrugAllergies field. And the same on each of the other tabs.
What am I doing wrong?
Also,
The one from the main form to the first tab does not appear to work if the tab is not already open (i.e. if the 2nd tab is open, it goes there).
Thank you.
Private Sub HouseholdWarnings_Instructions_AfterUpdate()
Forms![Main]![ClientReferralInfo].SetFocus
Forms![Main]![ClientReferralInfo].Form![Medicaid#].SetFocus
End Sub
works fine.
Then I am using the following to move from the last field of the 1st subform to the first field in the 2nd tab (which also contains a subform):
Private Sub InstallDate_KeyDown(KeyCode As Integer, Shift As Integer)
If Shift = 0 Then
If KeyCode = 9 Or KeyCode = 39 Then
Me.Parent!MedicalInfo.SetFocus
Me.Parent!MedicalInfo.Form![DrugAllergies].SetFocus
End If
End If
End Sub
It goes to the form, but the cursor is in the field AFTER the DrugAllergies field. And the same on each of the other tabs.
What am I doing wrong?
Also,
The one from the main form to the first tab does not appear to work if the tab is not already open (i.e. if the 2nd tab is open, it goes there).
Thank you.