Quote Originally Posted by |2eM!x
you could try:
VB Code:
  1. Private Sub command1_keypress(Keyascii as integer)
  2. if keyascii = 30 then ' i think its 30
  3. then keyascii = 0
  4. end sub
None of these will work. The _Click event fires regardless of what you do. Place a breakpoint
at the start of each of those procedures and you will see that they wont fire from an enter
key being presses, even with Form1.KeyPreview set to True.

Now if the command button does not have the focus and the Default is False
then thats another story.

If you want you can just have the command button never be able to recieve
the focus by setting the TabStop property ot False.

You may have to end up sub-classing the command button and handling the
enter keypress in order to cancel it out if the button in question has the focus.