Tab Control Shortcut Keys Don Work

T

Tigerfish

I have converted an application from Access 2000 to Access 2007. Users like
to use the keyboard rather than the mouse, and have requested shortcut keys
for all button controls and tab controls. The tab controls have been in
place for some time and worked fine in Access 2000. Since conversion,
however, some of the shortcut keys don’t work on some forms. Pressing the
Alt-G on the Contact form, for example, just produces a beep but works fine
on the Company form. Same with other Alt key combinations. Sometimes I get
the message about 2003 shortcut keys, but this is not generally the case. I
can’t see any other controls on these forms with the same shortcut keys. And
most of the forms that have tab controls have some tabs where the shortcut
key doesn’t work. I can’t find any references for problems with shortcut
keys on custom controls. They all seem to address Access or Office shortcut
keys. Does anyone have any insight into this problem.

I can just keep trying until a find a set of key combinations that work on
each form. But these forms are similar in many ways, i.e., each has a
General Info tab, and it would be confusing to have a different hotkey for
the General Info tab in each form.

I’m totally perplexed by this problem and would appreciate any suggestions.

Thanks.
 
A

Allen Browne

I'm not aware of a bug that would prevent A2007 from responding to hotkeys.

Presumably you are talking about using an ampersand character in the Caption
property of the Page control that's in a tab control. So if the page is
named pgeGeneral, you might set its Caption to:
&General
so that Alt+G jumps to that control.

There may be some other factor at work. For example, the cursor is in a
subform where a record is being edited but can't be saved yet (e.g. required
field is blank.) Of if you have typed just:
11/
into a date field, you won't be able to get out until you enter a valid
date, or undo the control.

If it's any use, the code below will list the shortcuts in use on Form1 if
you open it in design view, and then enter this in the Immediate Window:
? ShowShortcuts("Form1")

Function ShowShortcuts(strName As String, _
Optional bIsReport As Boolean) As String
Dim obj As Object
Dim ctl As Control
Dim strCaption As String
Dim lngPos As Long
Dim intAsc As Integer
Dim intCharCount(vbKeyA To vbKeyZ) As Integer
Dim i As Integer
Dim strOut As String

If bIsReport Then
Set obj = Reports(strName)
Else
Set obj = Forms(strName)
End If

For Each ctl In obj.Controls
If ctl.ControlType = acLabel Or ctl.ControlType = acPage Then
strCaption = ctl.Caption
lngPos = InStr(strCaption, "&")
If lngPos > 0& Then
If lngPos < Len(strCaption) Then
intAsc = Asc(UCase(Mid(strCaption, lngPos + 1&, 1&)))
If intAsc >= LBound(intCharCount) And intAsc <=
UBound(intCharCount) Then
intCharCount(intAsc) = intCharCount(intAsc) + 1
End If
End If
End If
End If
Next

For i = LBound(intCharCount) To UBound(intCharCount)
Select Case intCharCount(i)
Case 0
strOut = strOut & " "
Case 1
strOut = strOut & Chr$(i)
Case Else
strOut = strOut & Chr$(i) & Str(intCharCount(i))
End Select
Next

ShowShortcuts = strOut
End Function
 
T

Tigerfish

Allen,

Thank you for your comments and ShowShortcuts() function.

It doesn't matter which field or subform has focus. Some tab control
hotkeys just don't work. And others do. I can't find any duplicate usage.
And at one time these hotkeys did work. For the time being I'll just assign
other letters.

Unless you have any other suggestions.

Thanks for your help.
 
A

Allen Browne

If it's specific keystrokes, I don't suppose there's any AutoKeys macro
that's trapping those?

Or anything in the conrols' or forms' Key* events (KeyDown, etc.)?
 
T

Tigerfish

There are no autokey macros. There is code on the KeyUp event to cancel a
new record if the user presses Esc. That shouldn't be causing any problems.

It's perplexing. Some shortcuts are fine. And some Alt key combinations
that work on one form don't work on another. I've checked the ribbon
shortcuts and they are not the same.
 
T

Tigerfish

Hi Linq,

It's the shortcut keys for the tabs themselves that aren't working. And I
can see no reason why. There are four main forms in the application:
company, contact, contractor and project, that have four or five tabs. Each
tab has a shortcut key, i.e. Alt G for 'General Info'. Since converting to
2007 some of them don't work. It's not the same ones on each form. These
shortcut keys that don't work are not being use anywhere else on the form, or
in the Ribbon.

They should work.
 

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