Disable key

D

Dale Fye

Disable, no.

Bypass, yes.

You would have to set the Forms keyPreview property to Yes. Then, you could
use the Forms KeyDown event to test for the KeyCode value being equal to the
enter keys value and if it is, set KeyDown = 0.

Look up KeyPreview in Access Help for more details.

--
HTH
Dale

Don''t forget to rate the post if it was helpful!

email address is invalid
Please reply to newsgroup only.
 
M

Mike

No help. I have several message boxes that the user can click ok to. However
if they use the enter key and hold it down the message boxes are ran through
rapidly and the user is no seeing what the message box is trying to tell
them. By disabeling the enter key, they are forced to click OK rather than
holding down the enter key.
 
J

John W. Vinson

No help. I have several message boxes that the user can click ok to. However
if they use the enter key and hold it down the message boxes are ran through
rapidly and the user is no seeing what the message box is trying to tell
them. By disabeling the enter key, they are forced to click OK rather than
holding down the enter key.

You can set the default button of the MsgBox to the No button if that would
help:

iAns = MsgBox("blah blah blah", vbYesNo + vbDefaultButton2)

will cause using the Enter key to take the "No" action.

I am a bit concerned though - it sounds like you're requiring the user to
click a button to get any work done. This can be annoying to users - "yes,
dammit, I do want to <fitb>, I wouldn't have done so if I didn't want to!"
Some "social engineering" might be in order so that the application "fails
safe", and normally just does what it's supposed to do without the user
needing to take an extra step to confirm what they've done.

I know, I know... maybe you don't have that class of users... <g>
 
D

Dale Fye

Besides the idea mentioned by John Vinson, you could create your own message
box form, and use the technique I mentioned previously to "disable" the enter
key in that form only.

--
HTH
Dale

Don''t forget to rate the post if it was helpful!

email address is invalid
Please reply to newsgroup only.
 

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