Tab Control

  • Thread starter Thread starter ladybug via AccessMonster.com
  • Start date Start date
L

ladybug via AccessMonster.com

I have about 5 different subforms on a tab control. When I tab through a
subform at the end I would like to hit tab and automatically go to the next
subform. Currently, if I am in the last field and I hit tab it just clears
out my entry so that I could enter another entry.
Any suggestions?
 
Hi
Suggest you use the onkeypress event. This is a cut and paste from
something I happened to be doing today in a calendar type function. First I
create the field names as strings. I then use the keypress to set the focus.
In my situation below it is setting the focus on a subform. You just need
to set it on the control you want to use.

Good luck.

Private Sub Allocation_KeyDown(KeyCode As Integer, Shift As Integer)
' Decide what to do when navigation keys are pressed
subSetNextFields

Select Case KeyCode
Case Is = 37 ' Left Arrow
Forms!frmResourceDay.Form.Controls(strLeft).SetFocus '
Previous date
Case Is = 39 ' Right Arrow
Forms!frmResourceDay.Form.Controls(strRight).SetFocus '
Next date
Case Is = 40 ' Down Arrow
Forms!frmResourceDay.Form.Controls(strDown).SetFocus '
One week from now
Case Is = 38 ' Up Arrow
Forms!frmResourceDay.Form.Controls(strUp).SetFocus '
One week prior
Case Is = 9 ' Tab
Forms!frmResourceDay.Form.Controls(strRight).SetFocus '
Next date
Case Is = 13 ' Enter
Forms!frmResourceDay.Form.Controls(strRight).SetFocus '
Next date
End Select
End Sub
 
Back
Top