Ctrl V

proberts

New member
Local time
Today, 10:17
Joined
Jun 10, 2008
Messages
9
Does anyone know how to disable the "CTRL V" funtion in Access?
 
A possible solution would be to clear the clipboard when you enter a control.


In a module (not form code module) paste this code:

Code:
Public Declare Function CloseClipboard Lib "user32" () As Long
Public Declare Function OpenClipboard Lib "user32" (ByVal hwnd As Long) As Long
Public Declare Function EmptyClipboard Lib "user32" () As Long


Example of a control that you want to prevent pasting into:

Code:
Private Sub phonenumber2_GotFocus()
     OpenClipboard Me.hwnd
     EmptyClipboard
     CloseClipboard
End Sub
 
I am really curious. I have never has a need to do this. Maybe I can learn something about users. Why would you want to do this?
 
Create an AutoKeys Macro. In the Macro Name field type ^V and Action field select Echo and set the Echo On Property value to Yes.

Save the Macro with the name Autokeys. This will redefine the Ctrl+V function disabling the Paste action.
 
A better way -

If you set the form's KEY PREVIEW property to YES you can set the control's KEY DOWN event to have this code:

Code:
    If KeyCode = 86 And Shift = 2 Then
        KeyCode = 0
    End If
 
As in Post #3, gotta ask: Why would you want to do this?

Bob
 
As in Post #3, gotta ask: Why would you want to do this?

Bob

I can understand someone not wanting users to be able to paste things into a location. One would be a password input. There could be others as well. It will be interesting to see what the OP says.
 
Create an AutoKeys Macro. In the Macro Name field type ^V and Action field select Echo and set the Echo On Property value to Yes.

Save the Macro with the name Autokeys. This will redefine the Ctrl+V function disabling the Paste action.

My solution of clearing the clipboard will always work.

The problem with the autokeys method is that you can still paste into the control with other methods. The autokey method is also an all or nothing method. What it you want to do it only in one single control on one form, and no other place? ou will still need to add more code to block the other ways of pasting.
 
Good question .... Never occured to me anyone would want to disable this functionality. Might have to revamp my UI philosophy ....

One would be a password input. There could be others as well. It will be interesting to see what the OP says.

Good thought, just for FYI (and because I started having a mini-infarction at overlooking this) ... I just did a test in Access'07. It seems that if a control is set to password format (*****) the copy command on the ribbon, right-click menu, and ctrl-c shortcut are auto-disabled - but paste is not.

-dK
 
I can understand someone not wanting users to be able to paste things into a location. One would be a password input. There could be others as well. It will be interesting to see what the OP says.

Why would you care if someone paste into a control that is used for password input? :confused:

The few secured applications that I just tried, all let me paste the password, but not copy. Do you have an example of an application that does not allow a password to be pasted? They do limit the attempts you get before they lock the account down.

Not allowing copy makes sense to me, but not paste.
 

Users who are viewing this thread

Back
Top Bottom