Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Author |
Topic |
KnooKie
Aged Yak Warrior
623 Posts |
Posted - 2003-09-04 : 05:46:09
|
Using Access97.......I seem to be making hard work of what seems like a simple problem. I have some forms that are popup and modal. After the users has finished using them i want to allow them to close the form with a hotkey rather than the mouse. Ctrl-F4 does nothing because they are popups. I thought the KeyPress event might be the answer but there doesn't seem to be an Ascii value for Ctrl. Ideally something like Ctrl-Z would be handy.Any ideas ?many thanks====Paul |
|
mohdowais
Sheikh of Yak Knowledge
1456 Posts |
Posted - 2003-09-04 : 06:01:42
|
Have you tried Alt+F4?Try the KeyUp event instead of KeyPress. Also there is no ASCII value for the Ctrl, Alt and Shift Keys, you will have to identify that by comparing the Shift argument to the appropriate constants.Private Sub KeyHandler_KeyDown(KeyCode As Integer, Shift As Integer) Dim intCtrlDown As Integer ' Use bit masks to determine which key was pressed. intCtrlDown = (Shift And acCtrlMask) > 0 If (intCtrlDown And KeyCode = 65) Then MsgBox "You pressed CTRL+A" End IfEnd Sub Owais Make it idiot proof and someone will make a better idiot |
 |
|
KnooKie
Aged Yak Warrior
623 Posts |
Posted - 2003-09-04 : 06:20:07
|
Excellent thankyouer....quick question.....did you say KeyUp event or KeyDown ?Meanwhile.........As it goes i can't get it to work on either of them.Alt-F4 does work but the keys are annoyingly far apart. Better than a kick in the teeth though.====Paul |
 |
|
KnooKie
Aged Yak Warrior
623 Posts |
Posted - 2003-09-04 : 06:32:32
|
My fault entirely. Working nicely now.Got the KeyCode wrong for the letter Z (90)....it's not the ascii number is it (122 lower case).KeyUp event worked well tothanks again====Paul |
 |
|
|
|
|