Folks
I have a main form that contains several subforms, and I'm trying to manipulate navigation round the main form so that when a user tabs away from the last field of the last record in a subform, the focus goes to the next control in the main form (the default setting is for the focus to return to the first field of the first record in the subform).
I've tried two things:
Code:
Private Sub LastSubformField_KeyPress(KeyAscii As Integer)
If KeyAscii = 9 Then
If Me.NewRecord = True Then
Me.Parent!NextMainformControl.SetFocus
End If
End If
End Sub
Code:
Private Sub FindDocument_Button_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = vbKeyTab Then
If Me.NewRecord = True Then
Me.Parent!NextMainformControl.SetFocus
End If
End If
End Sub
But the problem is this. The KeyAscii method won't allow the focus to settle on LastSubformField when tabbing on to that field from the previous field – the focus goes straight to NextMainformControl. And the KeyCode method won't allow the focus to settle on NextMainformControl when tabbing on to that field from LastSubformField – the focus goes straight to the next-but-one field.
How the hell to I get the focus to settle on LastSubformField using the KeyAscii method or on NextMainformControl using the KeyCode method?
Remster