Are there any tricky ways to delete records from a form?

RSW

Registered User.
Local time
Today, 01:22
Joined
May 9, 2006
Messages
178
I have a form which had led to records being deleted erroneously. I took off the "Delete" button I had put on the form, and disabled the Delete key (keycode 46 is for both the regular Delete key and the one on the number pad, right?) I didn't think there were any other ways that a user could accidentally delete a record...but a few more seem to have disappeared. The database is compacted and repaired often, and doesn't seem to be corrupt in any way. Does anyone know of any other ways that a user might accidentally delete records?


Thanks in advance!
 
I could think of a few. How about, instead, protecting your records by setting Me.AllowDeletions=False ?
 
I could think of a few. How about, instead, protecting your records by setting Me.AllowDeletions=False ?

I'll do that as a last resort, but ideally I'd like admins to be able to delete records from the form (the "Delete" button still appears for admins, but neither of us deleted the records in question).

I'm definitely interested in hearing your ideas about how it might be happening!
 
eg context menus, menus on the ribbon (I m not sure but perhaps those just send a DEL) , deletions if the records are children of some parent, the parent gets deleted and cascade delete is on ...

And why "last resort"? You could enable deletions for specific users, otherwise leave it at False
 
  • Like
Reactions: RSW
And why "last resort"? You could enable deletions for specific users, otherwise leave it at False

That's a good idea--so would it just be something like this?

Code:
If IsUserMemberOfGroup("admins", CurrentUserID) Then
   Me.AllowDeletions = True
Else
   Me.AllowDeletions = False
End If

(the IsUserMemberOfGroup function works fine)
 
Do any users have access to tables directly?

Instead of a physical delete, you could do a logical delete --- set a field such that the record is not available for selection, or
put "deleted" records in a special table. It means changing some queries etc, but unless you find "the method being used to remove records", what choices do you have?

Do you record "who" deleted/changed/added records?
 
  • Like
Reactions: RSW
#5 Yes exactly. And check #6, jdraw has as usual some really good points :)
 
Just a minor point:

If IsUserMemberOfGroup("admins", CurrentUserID) Then
Me.AllowDeletions = True
Else
Me.AllowDeletions = False
End If

Is a lot neater written like this:

Me.AllowDeletions = IsUserMemberOfGroup("admins", CurrentUserID)
 

Users who are viewing this thread

Back
Top Bottom