Use the ctrl+t to move from tab to tab in a form

P

Penny Miller

I have a department that would like to be able to use the keyboard instead
of using the mouse to select a different tab in their form.

My form consists of the following;
In the Detail: I have a Tab Control (TabCtl211) that consists of 3 tabs and
with in the tabs there are several fields that they add/update

Case Entry/Update (0), Legal/Closure (1) and Restitution (2)

I want to use the ctrl+t to move from tab to tab, because they use the tab
key to move from field to field and then to new record.

How do I make this happen for them?

Penny
 
P

Penny Miller

Dirk,

I ended up using the ctrl+t because the probation officers don't use the
other tabs only the bookkeeper does and it works like a charm.
Thank you.

Dirk Goldgar said:
Penny Miller said:
I have a department that would like to be able to use the keyboard instead
of using the mouse to select a different tab in their form.

My form consists of the following;
In the Detail: I have a Tab Control (TabCtl211) that consists of 3 tabs
and with in the tabs there are several fields that they add/update

Case Entry/Update (0), Legal/Closure (1) and Restitution (2)

I want to use the ctrl+t to move from tab to tab, because they use the
tab key to move from field to field and then to new record.

How do I make this happen for them?


Note that there are a couple of options available to your for keyboard
navigation from tab to tab. For example, it's possible to set things up,
with a little contrivance, so that tabbing and backtabbing navigates
naturally between tabs, not moving to a new record just because you tab
out from the last control on the first tab. This is done by means of code
in "infinitesimal" controls (capable of receiving the focus, but too small
to be seen) that you insert into the tab order on each tab. As I said,
it's a bit contrived, but it works fine once you've set it up and allows
natural tabbing from page to page.

Second, you can choose a hot key in each tab page's caption. Thus, the
user could press Alt+E for "Case Entry/Update", Alt+L for "Legal/Closure",
and Alt+R for "Restitution". You do this by preceding the appropriate
character in the page's Caption property with an ampersand; e.g., "Case
&Entry/Update".

Third, if you still want to use Ctrl+T to move among tabs, you might do
like this:

Form properties
----------------------
KeyPreview: Yes
OnKeyDown: [Event Procedure]


'----- code in form module -----
Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer)

If KeyCode = vbKeyT _
And (Shift And acCtrlMask) > 0 _
Then
' Ctrl+T was pressed
KeyCode = 0 ' swallow the key
With Me.TabCtl211
If .Value = (.Pages.Count - 1) Then
.Value = 0
Else
.Value = .Value + 1
End If
End With
End If

End Sub

'----- end code -----


--
Dirk Goldgar, MS Access MVP
www.datagnostics.com

(please reply to the newsgroup)
 
M

MichaelRay via AccessMonster.com

You can use the Keypress event for the form. The ascii code for ctrl+t = 20,
so the code would be as follows. It will cycle through the tabs in order,
going from 3 back to 1. Be sure to set Key Preview to Yes for the form.



If KeyAscii = 20 Then
Select Case Me.TabCtl0.Value
Case 0:
Me.TabCtl0.Value = 1
Case 1:
Me.TabCtl0.Value = 2

Case 2:
Me.TabCtl0.Value = 0

End Select

End If
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top