how do i disable CTRL+< and CTRL+>

  • Thread starter Thread starter Keith G Hicks
  • Start date Start date
K

Keith G Hicks

More wisdom from MS I guess. Is this a new thing in Access 2003??? - this
nasty feature that lets users hit CTRL+< or CTRL+> to go to form design
views and such? I can't disable shortcut keys in my application so it seems
that I'll have to write some keypress code to disable this specifically. But
the problem is that I don't know how to disable CTRL+ types fo things. Easy
enough to do that for just a single key but what about for key combinations?
Does anyone have some code that handles this? Sure would be helpful.

:) Thanks,

Keith
 
Wow. I figured this was an easy one. Should I move this to a different NG?
Am I in the wrong spot?

Keith
 
You just need to be a little patient, Keith! :-) I looked into it, had some
difficulty with it, so asked some of the other MVPs. Sandra Daigle came up
with the following solution. You need to change the Key Preview property of
the form to 'Yes', then add this code to the form's Key Down event.

Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer)

Dim fShift As Boolean
Dim fCtl As Boolean
Dim fAlt As Boolean

fShift = Shift And acShiftMask
fCtl = Shift And acCtrlMask
fAlt = Shift And acAltMask

If fCtl Then
Debug.Print Shift, KeyCode
If KeyCode = 188 Or KeyCode = 190 Then
MsgBox "Sorry"
KeyCode = 0
End If
End If

End Sub

--
Brendan Reynolds (MVP)
http://brenreyn.blogspot.com

The spammers and script-kiddies have succeeded in making it impossible for
me to use a real e-mail address in public newsgroups. E-mail replies to
this post will be deleted without being read. Any e-mail claiming to be
from brenreyn at indigo dot ie that is not digitally signed by me with a
GlobalSign digital certificate is a forgery and should be deleted without
being read. Follow-up questions should in general be posted to the
newsgroup, but if you have a good reason to send me e-mail, you'll find
a useable e-mail address at the URL above.
 
Dear Brendan:

Forgive me if I am being dense, but is it the case that you cannot disable
the ctrl+< or ctrl+> using the autokeys macro? My attempts to do so have
failed, with Access rejecting key codes like " ^> " or " ^+, ", so it
appears as though you can't use the autokeys macro, but I've been wrong
often enough that I'd welcome confirmation that I'm correct! :)

Fred Boer
 
I haven't figured out how to do it either - normally this is the best way to
disable/enable a keyboard shortcut application wide. I've tried the
following:

^.
^{.}
^>
^{>}
"^{.}"

and several other similar combinations . . . no luck here.
 
Sorry Fred, but I can't answer that, I haven't tried it. My own attempt was
along the same lines as Sandra's code that I posted earlier, with the small
but rather important difference that Sandra's code works! :-)

--
Brendan Reynolds (MVP)
http://brenreyn.blogspot.com

The spammers and script-kiddies have succeeded in making it impossible for
me to use a real e-mail address in public newsgroups. E-mail replies to
this post will be deleted without being read. Any e-mail claiming to be
from brenreyn at indigo dot ie that is not digitally signed by me with a
GlobalSign digital certificate is a forgery and should be deleted without
being read. Follow-up questions should in general be posted to the
newsgroup, but if you have a good reason to send me e-mail, you'll find
a useable e-mail address at the URL above.
 
Dear Sandra:

Well, I'm pleased at least that I wasn't overlooking something obvious! I
don't have a lot of forms, so if I decide to implement your code it won't be
too much work, but if I had a big application, it would be a pain to add the
code in after the fact!

Perhaps it is something Microsoft will address in the future... My thanks to
you and Brendan.

Cheers!
Fred



Sandra Daigle said:
I haven't figured out how to do it either - normally this is the best way
to disable/enable a keyboard shortcut application wide. I've tried the
following:

^.
^{.}
^>
^{>}
"^{.}"

and several other similar combinations . . . no luck here.

--
Sandra Daigle [Microsoft Access MVP]
Please post all replies to the newsgroup.


Fred said:
Dear Brendan:

Forgive me if I am being dense, but is it the case that you cannot
disable the ctrl+< or ctrl+> using the autokeys macro? My attempts to
do so have failed, with Access rejecting key codes like " ^> " or "
^+, ", so it appears as though you can't use the autokeys macro, but
I've been wrong often enough that I'd welcome confirmation that I'm
correct! :)
Fred Boer
 
Back
Top