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 TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Moving between tabs 1

Status
Not open for further replies.

DLynnTX

IS-IT--Management
Dec 9, 2004
67
US
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.
 
you may try this:
...
Me.Parent!MedicalInfo.Form![DrugAllergies].SetFocus
KeyCode = 0
...

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top