Keypress and Click problem

Neji
02-23-2008, 09:15 AM
Good day guys! How can i make a form keypress function call a command click function? Im trying to make a typing tutor that's functional on both click and keypress. I already set keypreview to true but still im having problems...

Hope you guys could lend me some help.... Thanks in advance!!!

WinSpy
02-23-2008, 01:16 PM
you mean something like this?

Private Sub Command1_Click()
Debug.Print "I been pressed!"
End Sub

Private Sub Form_KeyPress(KeyAscii As Integer)
Debug.Print "Key pressed"
Command1_Click
End Sub

Private Sub Form_Load()
Me.KeyPreview = True
End Sub

Neji
02-24-2008, 08:42 AM
Actually most of my commands are placed in the Form_Keypress so that when i press a key it automatically does a command and a command.value is set to true so that one can "see" that the command button was clicked. But when you "really" use the Command button's click function its doesnt do anything...

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum