By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
444,027 Members | 1,313 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 444,027 IT Pros & Developers. It's quick & easy.

default keypress

P: n/a
How can the default functionality built into access by Microsoft be
turned off. For instance, when I hit the enter key on a form focus is
set to the next tab stop. How can I hit enter and that not happen?
Or how can I use the insert key and not be put into overwrite mode. I
would like to be able to do this via code structure and not via a
macro. Thank you.

seeker52
Nov 12 '05 #1
Share this Question
Share on Google+
3 Replies


P: n/a
Tools/Options/Keyboard

Then for each control Properties/Other/Enter Key behaviour.

Not sure how to alter the behaviour of the insert key. That's what it's for.

Mike
"seeker52" <ak*****@hotmail.com> wrote in message
news:8c**************************@posting.google.c om...
How can the default functionality built into access by Microsoft be
turned off. For instance, when I hit the enter key on a form focus is
set to the next tab stop. How can I hit enter and that not happen?
Or how can I use the insert key and not be put into overwrite mode. I
would like to be able to do this via code structure and not via a
macro. Thank you.

seeker52

Nov 12 '05 #2

P: n/a
ak*****@hotmail.com (seeker52) wrote in news:8c9f7d3a.0402152101.36ee8261
@posting.google.com:
How can the default functionality built into access by Microsoft be
turned off. For instance, when I hit the enter key on a form focus is
set to the next tab stop. How can I hit enter and that not happen?
Or how can I use the insert key and not be put into overwrite mode. I
would like to be able to do this via code structure and not via a
macro. Thank you.


Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer)
Select Case KeyCode
Case vbKeyReturn
' do your thing or do nothing
KeyCode = 0
Case vbKeyInsert
'do your thing
KeyCode = 0
End Select
End Sub

Depending upon your needs, you may have to write this kind of procedure for
individual controls.

--
Lyle
(for e-mail refer to http://ffdba.com/contacts.htm)
Nov 12 '05 #3

P: n/a
"seeker52" <ak*****@hotmail.com> wrote in message
news:8c**************************@posting.google.c om...
How can the default functionality built into access by Microsoft be
turned off. For instance, when I hit the enter key on a form focus is
set to the next tab stop. How can I hit enter and that not happen?
Or how can I use the insert key and not be put into overwrite mode. I
would like to be able to do this via code structure and not via a
macro. Thank you.

seeker52

Set the KeyPreview property of the form to True (in the Event tab of form's
properties). Then put code into the form's KeyDown event. This means you
can handle this event before the textbox ever sees the keystroke. Although,
altering standard behaviour of the enter key might come under the category
of 'annoying and unexpected' - see Case vbKeyA below:
Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer)

Select Case KeyCode

Case vbKeyInsert
' Cancel it
KeyCode = 0

Case vbKeyReturn
' Cancel it
KeyCode = 0

Case vbKeyA
' Do soemthing annoying and unexpected
KeyCode = vbKeyB

End Select

End Sub
Fletcher
Nov 12 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.