Keydown Even No Working In Form

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have a Form with a ListBox and a Command Button. On the Form, I selected
the OnKeyDown Event and placed a Stop in the vba code to stop when it was
reached. When the form was open, I tried press any key and the OnKeyDown
Event never got to the Stop.

The command button doesn't have any cancel or default set to yes.

What am I doing wrong??

Thank You,

Gary
 
Gary said:
I have a Form with a ListBox and a Command Button. On the Form, I
selected the OnKeyDown Event and placed a Stop in the vba code to
stop when it was reached. When the form was open, I tried press any
key and the OnKeyDown Event never got to the Stop.

The command button doesn't have any cancel or default set to yes.

What am I doing wrong??

You probably didn't set the form's KeyPreview property to Yes. If you
don't do that, the form never sees the keys if any control has the
focus.
 
Back
Top