WilloWomble
asked on
Shortcut Keys
Hi,
I am developing an Access App & I want to 'listen' for keys to open specific forms from anywhere in the app. For example <Crtl & S> opens the suppliers form.
I am using code like:
Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = vbKeyF1 Then .....
But can't work out how to listen to key combinations such as Ctrl + S
Cheers
Doug
I am developing an Access App & I want to 'listen' for keys to open specific forms from anywhere in the app. For example <Crtl & S> opens the suppliers form.
I am using code like:
Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = vbKeyF1 Then .....
But can't work out how to listen to key combinations such as Ctrl + S
Cheers
Doug
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Here you go also:
Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer)
'Shift Argument for the 7 combinations of Shift, Ctrl and Alt keys:
'0 None
'1 Shift Key
'2 Ctrl Key
'3 Shift + Ctrl Keys
'4 Alt Key
'5 Shift + Alt Keys
'6 Ctrl + Alt Keys
'7 Shift + Ctrl + Alt Keys
'----------------------------------------
End Sub
Howdo MX, how ya doing!
Very brief visit. Its that time of the year when I need to get 3k points just to keep my membership alive, ha!
For specific code wise, MX version better obviously. A dirtier way is to store the last key hit. Not as elegant of course
Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer)
Static iLastKeyCode As Integer
If iLastKeyCode = 17 And (KeyCode = Asc("S") Or KeyCode = Asc("s")) Then
MsgBox "CTRL=S Hit"
End If
iLastKeyCode = KeyCode
End Sub
Very brief visit. Its that time of the year when I need to get 3k points just to keep my membership alive, ha!
For specific code wise, MX version better obviously. A dirtier way is to store the last key hit. Not as elegant of course
Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer)
Static iLastKeyCode As Integer
If iLastKeyCode = 17 And (KeyCode = Asc("S") Or KeyCode = Asc("s")) Then
MsgBox "CTRL=S Hit"
End If
iLastKeyCode = KeyCode
End Sub
I meant specific form wise, not specific code wise
doh!
doh!
That time of the year, huh. Seems to be that time of the 'month' for some people I know, lol.
Also, for someone with 5.37 million pts ... how the hell could EE require you to get 3K / month to keep it status quo!!! Just not right!
mx
Also, for someone with 5.37 million pts ... how the hell could EE require you to get 3K / month to keep it status quo!!! Just not right!
mx
well its all about money I guess. Im not sure how I amassed the points this year, must be due to cleanups as I have hardly been here.
btw ... been a couple of great discussion with our friend Leigh:
https://www.experts-exchange.com/questions/23124035/How-do-I-refer-to-multiple-return-values-from-a-function-using-the-query-design-view.html?cid=238&anchorAnswerId=20784563#a20784563
https://www.experts-exchange.com/questions/23124740/Using-Like-in-Access-SQL.html?cid=238&anchorAnswerId=20784502#a20784502
https://www.experts-exchange.com/questions/23124035/How-do-I-refer-to-multiple-return-values-from-a-function-using-the-query-design-view.html?cid=238&anchorAnswerId=20784563#a20784563
https://www.experts-exchange.com/questions/23124740/Using-Like-in-Access-SQL.html?cid=238&anchorAnswerId=20784502#a20784502
How we doing here ?
mx
mx
mx