Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

What nasty key combination does this 1

Status
Not open for further replies.

ZOR

Technical User
Jan 30, 2002
2,963
0
0
GB
I tried holding down the control key when I had a form open. I found by also pressing the letter A while keeping control down, my records on the form went strange, I tried a few other keys and a messagebox came up saying I had put a large amount of text on the clipbord, keep or not. I said no, closed the form and when I went back into the form I had no records and my tables were empty!!! Anybody know whats going on? Even more, how do I prevent such a thing happening. When a user gets loose on the application, they will soon mess it up. Thanks
 
Have a look at the Edit menu.
Ctrl-A select all records
Ctrl-X cut

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
Thanks PHV. I will look for the key codes and put something in a keypress trap. Hope there are no other combinations that can be destructive as this one. Good job I had backup tables. Best regards
 
Just killed Keycode 16. Anymore I should know about, thanks
 
Can someone tell me how I can eliminate a user using CTRL and any other key whilst using the database normally, that will damage data or give errors. Something thats global to protect the DB when they are on a form/textbox/listbox etc. Many thanks
 
I use an AutoKeys macro (one of only two scenarios where I will use a macro) to globally disable specific key combinations. I'm not sure this can be used to disable any Ctrl + <any key> combination.

The only solution I can think of is to use a Windows API call to hook the keyboard to block these key combinations. Let me know if you want some sample code.

One caveat is this would affect all running applications, unless you specifically program it to only affect your Access application.

What behaviour are you trying to disable. There is almost certainly an easier way than detecting/blocking key strokes.

Ed Metcalfe.

Please do not feed the trolls.....
 
I think that the delete may have worried you. I nearly always set Allow Delete to No for forms. It is possible to use Key Preview with forms, so that you can tell what keys have been pressed and decide what to do about them, but I think that the only really worrying one is CTRL + X.
 
Thanks both. Yes Remou, it seems the CTRL + X is the most destructive so far. How does one disable this during an application? Thanks again
 
Do you not wish to set Allow Delete to No?
 
I just set the form properties allow deletions to no, is that what you mean?. It seems to have taken the problem away, however holding down CTRL, I could bring find/replace, Print, and other things up. I really want to stop everything from being there other than it being a straight database. There seem to be so many doors open for people to wreck a database, who can then say it was my fault. Any other suggestions greatly appreciated.
 
Oh boy am I suffering with this pile of rubbish as an application. When having clicked a list (which is a list of records a user can select) and I hold down CTRL and V, the contents of my form change records. I never had problems like this with earlier versions of Access. This is the last thing I want at this stage - Help!!
 
Try setting KeyPreview for the form to Yes, and then look at this idea:

Code:
Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer)
If Shift = 2 Then
    MsgBox "Hands off the CTRL key!"
End If
End Sub
 
Hey, you saved my skin. I did find another bit of code that allows certain use of CTRL,

If ((Shift And acCtrlMask) > 0 And (KeyCode = vbKeyV)) Then
KeyCode = 0
Shift = 0
End If

Where some keycodes could be let through, but yours is by far the best, I can add a message in a bit stronger than yours to keep their fingers off. Many thanks again, a well deserved star.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top