you can change the Allow Delete property of the form to "No"
This is on the Data tab of the form property dialog.
How to avoid the use of Control+A (Select all records).
Me.AllowDeletions = ValidUser
Open in new window
How to avoid the use of Control+A (Select all records).>>
Along the lines of the AutoKeys marco, which is application wide, you can disable it just for this form by:
1. Turning on the Form's KeyPreview property.
2. They in the keydown event, you can do:
If KeyCode - vbKeyA And Shift = acCtrlMask Then
KeyCode = 0
This will "eat up" Ctrl/A and disable it from being used.
I generally use something like the current event, or the form Open event to determine whether the current user has delete permissions, then I do like John suggested above
Private Sub Form_Open(Cancel as integer)
me.AllowDeletions = bUserHasDeletePermissions
the real issue becomes determining who should have delete permissions and who shouldn't. Is this an application wide property that you can set when your application loads, or do you need to do this individually by form? If by form, then it is probably role based, so you would need to map individuals to roles and use those roles to determine who has those permissions.
IT issues often require a personalized solution. With Ask the Experts™, submit your questions to our certified professionals and receive unlimited, customized solutions that work for you.