|
-
Aug 10th, 2006, 05:07 PM
#1
Thread Starter
Member
[RESOLVED] KeyPress problem
Hello,
I have a problem in following sub:
VB Code:
Private Sub Form_KeyPress(KeyAscii As Integer)
If KeyAscii = 19 Then
If cmdSave.Enabled = True Then
cmdSave_Click
End If
MsgBox KeyAscii 'Trying to figure out this....
Else
mbDirty = True
Call CheckButtons
End If
End Sub
I have ctrl+s key combination saving current recordset on the form. Everything is fine except when focus is on ComboBox and I try ctr+s, it brings item in ComboBox list starting with letter "s".
I tried to put similar code in keyup event, but result is the same.
Please help.
Deki PA
-
Aug 10th, 2006, 05:09 PM
#2
Thread Starter
Member
Re: KeyPress problem
Just one more note...
VB Code:
MsgBox KeyAscii 'Trying to figure it out....
with this in code it works fine, but I don't want this msgbox to pop-up.
-
Aug 10th, 2006, 05:31 PM
#3
Re: KeyPress problem
VB Code:
If KeyAscii = 19 Then
If cmdSave.Enabled = True Then
cmdSave_Click
[B]KeyAscii = 0[/B]
End If
-
Aug 10th, 2006, 08:22 PM
#4
Addicted Member
Re: KeyPress problem
try this in Form_keydown event... im using this on my program... but i use F2 in saving
the ctrl + s would be
(Shift = 2 and Keycode = 83)
VB Code:
If (KeyCode = 113) Then
cmdSave_Click
End If
Note: don't forget to set the Form Keypreview Property into True
-
Aug 11th, 2006, 09:46 AM
#5
Thread Starter
Member
Re: KeyPress problem
 Originally Posted by bushmobile
VB Code:
If KeyAscii = 19 Then
If cmdSave.Enabled = True Then
cmdSave_Click
[B]KeyAscii = 0[/B]
End If
Thank you all. I used Bushmobile's code above, just moved KeyAscii = 0 below End If in my case. Works great!
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|