Penn White
ecritt1 at alltel.net
Thu Mar 16 09:09:41 CST 2006
> I suppose I could set the KeyPreview to true on all the sub forms but
> then they'd also have to have a copy of the KeyDown routine as well, no?
Congratulations!!
I also got it working by copying the KeyDown sub to the subform control that
gets the focus when you go to the tabbed page. It didn't work when I used
the KeyDown event for the subform itself. I like your way but I also like
having the user end up in the correct first control on the form for data
entry. If they hit Tab or Enter when the focus is on the Exit button, I'm
not sure where the cursor would go to. I'm also not sure the KeyCode=0 is
necessary but I haven't tested it.
I also use this for PgUp and PgDn to go to the next main record because when
you're in a subform, as you know, it just tries to go to the next record in
the subform and really gets screwed up.
Private Sub FullName_KeyDown(KeyCode As Integer, Shift As Integer)
Dim intAltDown As Integer
intAltDown = (Shift And acAltMask) > 0
If intAltDown Then
Select Case KeyCode
Case 76 ' L
Me.Parent.Pg1.SetFocus
KeyCode = 0
Case 78 ' N
Me.Parent.Pg2.SetFocus
KeyCode = 0
Case 68 ' D
Me.Parent.Pg3.SetFocus
KeyCode = 0
Case 83
Me.Parent.Pg4.SetFocus
KeyCode = 0
End Select
End If
End Sub
Penn