By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,528 Members | 1,305 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,528 IT Pros & Developers. It's quick & easy.

How to disable CTRL-S, but not CTRL-C/CTRL-V

P: 99
For complicated reasons, I am disabling Ctrl-S on a form, so that users have to use the Save button. I have the following code, which works fine:

Expand|Select|Wrap|Line Numbers
  1. Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer)
  2.     Select Case True
  3.     Case (Shift = acCtrlMask)
  4.         Beep
  5.         KeyCode = 0
  6.     Case ((Shift = 0) And (KeyCode = vbKeyCancel Or KeyCode = vbKeyReturn Or KeyCode = vbKeyEscape))
  7.         Beep
  8.         KeyCode = 0
  9.     End Select
  10. End Sub
But this disables Ctrl-anything!! I would like users to still be able to cut and paste data in fields.

Is there any way of catching the NEXT key after CTRL has been pressed down? I had thought the 'KeyCode' might be the next key, but it isn't! It is "17" which is the code for CTRL itself.

(Long time since I've been here! Hope you are all still there?!!)
Jul 28 '10 #1
Share this question for a faster answer!
Share on Google+

Post your reply

Sign in to post your reply or Sign up for a free account.