Key combination causes record to be deleted in linked table???

  • Thread starter Thread starter Howard Ducat
  • Start date Start date
H

Howard Ducat

I have a form with subforms in my application.
One of the fields in a subform is to store an Email
address.

A user was updating an Email address from an old address
to a new one that had an underscore in it, and
inadvertantly deleted the entire record for the person.

Upon trying to figure out what happened (We do not allow
regular users to delete records at all...), we stumbled
upon the key combination that caused the record to be
deleted. When the person was typing the Email address,
they hit CTRL-Underscore instead of Shift-underscore.
CTRL-Underscore deletes the record every time.

Can this somehow be disabled?

Howard Ducat
 
Hi Howard,

Thank you for using MSDN Newsgroup! It's my pleasure to assist you with
your issue.

First of all, I would like to confirm my understanding of your issue.

From your description, I understand that you met with some problems with
some shortkeys in MS Access. I tested and searched a lot but failed to find
the CTRL-Underscore shortkeys. Fortunately, it occurred to me that it may
be a CTRL+ Minus (-) Key combination which will delete the current record.
Have I fully understood you? If there is anything I misunderstood, please
feel free to let me know.

==========================================
[Press] [Entering data in Datasheet or
Form view]
CTRL+SEMICOLON (;) To insert the current date
CTRL+COLON (:) To insert the current time
CTRL+ALT+SPACEBAR To insert the default value for a field
CTRL+APOSTROPHE (') To insert the value from the same field in the previous
record
CTRL+PLUS SIGN (+) To add a new record
CTRL+MINUS SIGN (-) To delete the current record
SHIFT+ENTER To save changes to the current record
SPACEBAR To switch between the values in a check box or option button
CTRL+ENTER To insert a new line
===========================================

Based on my further research on the CTRL+ Minus (-), I find it hard to
disable THIS key combination in the Macro, even though I can easily disable
some shortkeys such as CTRL+F1 in the Micro by means of referencing it with
^{F1}. I tried a lot and failed to reference it in the Micro. Whenever I
use ^{-}, ^[-], ^"-" or something else in the Micro, Access reports the
wrong syntax and I cannot continue to successfully disable it.

I turned my steps to help you draft a code sample trying to disable this
key combination. Thanks god that I can trace if the CTRL key is pressed
down and if the Minus(-) (ASCII Code 189) is pressed down at the same time.
If that, we should not let the use delete the current record even if the
key combination is deliberately pressed (I guess the user mis-pressed this
key combination when they edited the records).

To workaround this problem, you can add the following code into the
problematic form. Whenever the user press the CTRL+ Minus (-), the beep
sound will pop up and a message will be displayed. In this case, the key
combination is eventually disabled.

================================
Private Sub Email_KeyDown(KeyCode As Integer, Shift As Integer)

Dim intCtrlDown As Integer
intCtrlDown = (Shift And acCtrlMask)
If intCtrlDown > 0 And KeyCode = 189 Then
Beep
MsgBox "Pay attention to the shortkeys!"
'Exit Sub
End If
End Sub
================================


Howard, please apply my suggestions above let me know if this helps resolve
your problem. If there is anything more I can do to assist you, please feel
free to post it in the group.


Best regards,


Billy Yao
Microsoft Online Support
 
Back
Top