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

Tabbing through Subforms without pushing ctrl+tab

Status
Not open for further replies.

aaronmc52

MIS
May 6, 2003
11
US
I have a form(frmenter) that contains a subform (frmentersubform) and this form contains 25 subforms (frmentersubform1, frmentersubform2, frmentersubform3 etc.. through 25.) I am trying to find a solutiion that will allow me to press only the tab or the "+" key to jump from last field in the subform to the first field in the next subform without making the user press and hold the ctrl key while pressing the tab key. I understand that I am going to need to use some sort of code here. If your solution involves that please help me out by giving detailed response. I thank you very much in advance!
 
Paste this code in your form procedures

Private Sub Form_Load()

Me.KeyPreview = True

End Sub

Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer)
Select Case KeyCode
Case vbKeyF2 'This is where you change the key.
SendKeys "^{TAB}", False 'This is what action you're performing, Ctrl + Tab.
Case Else
End Select
End Sub

Choosing F2 will make it tab to different tabs.
You should be able to choose which key you want the user to click.

Hope this helps.
 
Thanks! Now how do I disable the TAB key within this form?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top