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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

cntrl + a 2

Status
Not open for further replies.

bigjohn99

Programmer
Jul 20, 2004
13
0
0
US
While a form is opened, pressing on cntrl+a and then delete would actually all the records from the table that is bound to the form. Is this a hole in Access and is there a way to circumvent it?

Thanks.
 
Is this a hole in Access
Exactly same behaviour in windows explorer ...
 
There is a visual clue if you try it on a continues form. You can see all the records' record selector buttons highlighted.

________________________________________________________
Zameer Abdulla
Help to find Missing people
There’s a world of difference between editorials and advertorials
 
same behaviour in excel and word too.


Ian Mayor (UK)
Program Error
Programmers do it one finger at a time!
 
Try this (borrowed from Roy Vidar)

Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer)
'NOTE: Form KeyPreview property must be set to Yes.
On Error GoTo Form_Keydown_Err

If ((Shift And acCtrlMask) > 0 And (KeyCode = vbKeyA)) Then
MsgBox "ctrl-A pressed!"
KeyCode = 0
Shift = 0
End If

Form_KeyDown_exit:
Exit Sub

Form_Keydown_Err:
msgbox Err.number
Resume Form_KeyDown_exit

End Sub
 
Evalesthy's post works! I was doing the same thing along the line accept I was not awared of the KeyPreview property.
This is great!

I also noticed that user can also select all records from Menu Bar --> EDIT --> Select All. The suggested code would not intercept it and Customize Menu Bar would only allow you to ADD items but not deleting them. Any suggestions?

Thanks.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top