UtterAccess.com
X   Site Message
(Message will auto close in 2 seconds)

Welcome to UtterAccess! Please ( Login   or   Register )

Custom Search
 
   Reply to this topicStart new topic
> Effective Disabling Of Keycode? (prevent Deleting Record By Mistake), Access 2007    
 
   
hjeff71
post Jun 12 2018, 09:48 AM
Post#1



Posts: 51
Joined: 5-January 09



Just learned the hard way that CTRL+- "the minus sign" will delete the record that you're on,... without warning.

What would be the best thing to do here:

a. create a keydown event on every form to catch the key combination?
b. create a global mod to disable ctrl all together?
c. some other ways?

Just trying to figure out the most effective way to do this,

Any suggestion would be appreciated,

Thanks,
Go to the top of the page
 
theDBguy
post Jun 12 2018, 10:02 AM
Post#2


Access Wiki and Forums Moderator
Posts: 73,215
Joined: 19-June 07
From: SunnySandyEggo


Hi,

Not sure about the "best" but I pick c. Autokeys macro.

Hope it helps...

--------------------
Just my 2 cents... "And if I claim to be a wise man, it surely means that I don't know" - Kansas
Access Website | Access Blog | Email
Go to the top of the page
 
hjeff71
post Jun 13 2018, 01:01 PM
Post#3



Posts: 51
Joined: 5-January 09



Thanks for the suggestion,
I did do a macro, using the AutoKeys, Macro Name: ^-
But upon saving it says: '' The key or key combination ^- in AutoKeys has invalid syntax or is not allowed ''
Otherwise that would have been a good solution,
Any other thoughts?
Go to the top of the page
 
theDBguy
post Jun 13 2018, 01:04 PM
Post#4


Access Wiki and Forums Moderator
Posts: 73,215
Joined: 19-June 07
From: SunnySandyEggo


Hi,

If Autokeys macro doesn't work, then you're probably stuck with "touching" every object in your database to trap the keystroke combo.

I'll see if I can find another solution and let you know.

--------------------
Just my 2 cents... "And if I claim to be a wise man, it surely means that I don't know" - Kansas
Access Website | Access Blog | Email
Go to the top of the page
 
theDBguy
post Jun 13 2018, 01:46 PM
Post#5


Access Wiki and Forums Moderator
Posts: 73,215
Joined: 19-June 07
From: SunnySandyEggo


Hi,

I'm still looking; but so far, nothing looks promising.

Good luck!

--------------------
Just my 2 cents... "And if I claim to be a wise man, it surely means that I don't know" - Kansas
Access Website | Access Blog | Email
Go to the top of the page
 
tina t
post Jun 13 2018, 01:58 PM
Post#6



Posts: 5,514
Joined: 11-November 10
From: SoCal, USA


QUOTE
Just learned the hard way that CTRL+- "the minus sign" will delete the record that you're on,... without warning.


i just built a basic database, one table with three records. i bound the table to a simple form, and used the table to make a simple query. using Ctl+-, i tried deleting a record directly from the open table, via the open form, and via the open query. in every case, i got the standard warning msg "You are about to delete 1 record(s)...." in the standard Yes/No msgbox, and was able to avert the deletion by clicking the No button, as usual.

now, i'm using A97, and you're using A2007 - but still, suggest you check to see if you have Warnings turned off at the time you're attempting to delete the record.

hth
tina

--------------------
"the wheel never stops turning"
Go to the top of the page
 
projecttoday
post Jun 13 2018, 02:11 PM
Post#7


UtterAccess VIP
Posts: 10,049
Joined: 10-February 04
From: South Charleston, WV


I also tried it and I also got the warning popup.

--------------------
Robert Crouser
Go to the top of the page
 
isladogs
post Jun 13 2018, 03:19 PM
Post#8



Posts: 453
Joined: 4-June 18



In 20 years of using Access, I've never known the 'Ctrl -' combination to be an issue.
Yes it will delete records but, as others have said, only after a warning UNLESS you have disabled warnings in Access Options - a BAD IDEA!

So I don't see this as an issue but, in case its useful, I offer the following:

You can disable individual keys by resetting them to nothing
To do so, set KeyPreview = Yes in the form property sheet
Then use code like this in the Form_Load event:

CODE
Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer)

    'Used to disable selected individual input key values by resetting to nothing
    'KeyPreview MUST be set to Yes in the form properties

    Select Case Shift
            Case acCtrlMask
                KeyCode = 0
    End Select

    Select Case KeyCode
            Case vbKeySubtract
                    KeyCode = 0
    End Select

End Sub


The obvious disadvantage with this is that it prevents other uses of the Ctrl and - keys

Disabling keyboard combinations such as Ctrl+- can only be done using the registry
However this will act globally & affect all programs

If you still want to proceed, you need to edit the following registry key
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Keyboard Layout\Scancode Map

ALL CHANGES ARE DONE AT YOUR OWN RISK

Attached are 2 documents which explain this in detail
a) Disable keyboard items using the registry
b) Remap any key using SharpKeys - this is a free utility that will do the registry changes for you

PLEASE READ/STUDY THESE CAREFULLY

I have used both of these methods successfully on several occasions to lock down various keyboard combinations e.g. Alt+Tab, Ctrl+Alt+Del, Ctrl+Esc, Win+E, Ctrl+C, Ctrl+V
However NEVER for this combination

The changes will take effect after logging back in or restarting

If anyone is interested, I can upload an example of a highly locked down database created as a DEMO for a client who wanted a kiosk style database that was permanently on.
The client wanted to prevent users being able to escape the database in order to use the workstation for any other purpose



Attached File(s)
Attached File  Disable_Keyboard_items_using_registry.zip ( 107.59K )Number of downloads: 3
Attached File  Remap_Any_Key_using_SharpKeys.zip ( 164.47K )Number of downloads: 4
 

--------------------
nil illigetimi carborundem est
Go to the top of the page
 


Custom Search
RSSSearch   Top   Lo-Fi    20th September 2018 - 05:38 AM