Disable Ctrl + ' Keystroke

Brian1960

Brian1960
Local time
Today, 17:48
Joined
Aug 13, 2004
Messages
141
I have a client with a front end MDB linked to a backend database.
The users are in the habbit of entering a date (in a memo field) using Ctrl + ; keystrokes but occasionally use the apostrophie Ctrl+') instead. This copies the previous record's entry into the memo field on the form.

Is there a way of eother stopping Ctrl+' or capturing the keystrokes and cancelling their effect.

Thanks.
 
I have a client with a front end MDB linked to a backend database.
The users are in the habbit of entering a date (in a memo field) using Ctrl + ; keystrokes but occasionally use the apostrophie Ctrl+') instead. This copies the previous record's entry into the memo field on the form.

Is there a way of eother stopping Ctrl+' or capturing the keystrokes and cancelling their effect.

Thanks.

Hey Brian,

Are you wanting the Ctrl key to be disabled altogether? or just the combination of Ctrl + '? You should be able to accomplish either one by using Keycode in the Forms Key Down event. You would use Keycode to determine if the Ctrl key has been pressed and then code from there what you want to have happen. You should be able to do a search, here, or a google search and have plenty of hits to get the gest of what to do. If not, then post back and I'm sure someone would be glad to lend a hand with your code.

HTH,
Shane
 
Captue Keycode

I'd like to capture the combination of Ctrl + '? You should be able to accomplish either one by using Keycode in the Forms Key Down event. You would use Keycode to determine if the Ctrl key has been pressed and then code from there what you want to have happen.
What I want to trap and prevent is Ctrl + ' but allow Ctrl + ; and I can't seem to work out which event to use or apture the two key press. If I trap on key press then when the user presses Ctrl it traps but we need to wait to see the second key.
I am at a loss and have searched everywhere.
Thanks if anyone can help.
 
Solution

For every key down event check if there is a Ctrl Key and the if there is check if there is a KeyCode of 192 (') if it then set it to 0.;)
Code:
Private Sub MemoBox_KeyDown(KeyCode As Integer, Shift As Integer)
'MsgBox KeyCode
If Shift = acCtrlMask Then
    If KeyCode = 192 Then
        KeyCode = 0
    End If
End If
End Sub
 
For every key down event check if there is a Ctrl Key and the if there is check if there is a KeyCode of 192 (') if it then set it to 0.;)
Code:
Private Sub MemoBox_KeyDown(KeyCode As Integer, Shift As Integer)
'MsgBox KeyCode
If Shift = acCtrlMask Then
    If KeyCode = 192 Then
        KeyCode = 0
    End If
End If
End Sub

Good job, Brian. I apologize for getting back to you sooner but I drive around a lot for my job so I just got it. Glad you got it going.

Shane
 

Users who are viewing this thread

Back
Top Bottom