Subform navigation

  • Thread starter Thread starter Gitche Gumee
  • Start date Start date
G

Gitche Gumee

I am using the On Exit event for a control on a subform to set focus back to
the next control on the main form. This works fine if the user has pressed
Tab to navigate to the next field. However, if the user uses the mouse to
click to a different field, the On Exit code will be a major annoyance.

How can I capture whether the user has pressed the Tab key to go to the next
field?
 
I have found that it works -- or doesn't wor, rather -- the same with or
without the KeyPreview property on. When I tab out of the subform, it skips
over the "set focus" field and jumps to the next. ?
 
My response was to Linq's use of the KeyDown event. If you don't have the
Key Preview set to Yes then it won't recognize the KeyDown event.

Bob Larson
 
As I mentioned to Bob, this is not quite working.

Here's my code:

Private Sub ITLTMember_KeyDown(KeyCode As Integer, Shift As Integer)

If KeyCode = 9 Then
Forms!frmMain![frm Project Information].Form![Benefit Type].SetFocus
End If

End Sub

What happens is that instead of going to [Benefit Type] (tab index 32) the
focus goes to the next field in the tab index [Opportunity type] (tab index
33).
 
Back
Top