Re: Tab Control Shortcut Keys Don Work

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance



nice, Allen, very handy utility - thanks! :) tina


"Allen Browne" <AllenBrowne@xxxxxxxxxxxxxx> wrote in message
news:O%236ph3rSJHA.4764@xxxxxxxxxxxxxxxxxxxxxxx
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

--
Allen Browne - Microsoft MVP. Perth, Western Australia
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

"Tigerfish" <Tigerfish@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:EA136600-74D1-43B7-A123-467668B9B46E@xxxxxxxxxxxxxxxx
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.

--
Michelle



.


Quantcast