Delete Current Record With Password

Have you tried entering a password of StrUser ?
I entered correct password in InputBox but form message me "Incorrect Password"
Edit/
Each user should be logon DB with password when he want to access database.
 
Look at your code.!!! :(

You have hardcoded "strUser", even if you were trying to use strUser variable that would not work as it contains a Select string.???

Use DlookUp() to get the password for the correct user.

Again go through the code in the debug window. That should show even you, where the problem lies.?
 
@Gasman thanks for the assist.
 
Isaac & Gasman
I am sorry, I have many trouble with InputBox. I waste time for InputBox.
Now I have to back my first thing operate by FORM
cmdDelete > open form frmFormPasswordSet > DELETE

Now problem is data not delete. Attached DB.
 

Attachments

:rolleyes: :rolleyes: :rolleyes: :rolleyes: :rolleyes:
1600503597278.png


I would be unlikely top open it anyway, as I only have 2007, but thought I'd try.
 
I'm a glutton for punishment, but I'm diving back in for another attempt.

I saw your db. What if you

  1. add a column to tblUsers called NetworkUsername
  2. in your Delete button, add code to look up tblUsers and see if the logged-in user-- environ("username") -- if their column "candelete" is checked to True. If yes, allow the delete, no more questions. If not, disallow the delete, no more questions.
 
Hi. Pardon me for jumping in. Seems to me all these hard work might be for something that doesn't actually get you want you wanted to have in the end anyway. If I understand it correctly, you got concerned because people "accidentally" deleted some records but wouldn't admit to it. So, you thought providing a password would solve that problem. Which problem would that be? If a user accidentally deletes a record by providing a password, what problem did you prevent? Aren't you going to be in the same situation as before you asked for the password anyway? The record still got deleted accidentally, and the user can still deny that they did it. (Somebody else must have done it and used their password, not me.)

Just my 2 cents...
 
Last edited:
That's a great thought dbGuy!! Way to see the bigger picture. That makes sense.
@smtazulislam maybe you end up doing both. 1) look up in table to see if they have Delete permission, because why not - you already have that in place in your table, and 2) Log WHO did the delete.

This is an example of why I like to use explicit buttons on my forms - Save, Delete, Add. You always end up wanting to trap so many types of details anyway, you might as well put it 100% behind a cmdButton rather than trying to endlessly hook into events and/or use data macros.
 
That's a great thought dbGuy!! Way to see the bigger picture. That makes sense.
@smtazulislam maybe you end up doing both. 1) look up in table to see if they have Delete permission, because why not - you already have that in place in your table, and 2) Log WHO did the delete.

This is an example of why I like to use explicit buttons on my forms - Save, Delete, Add. You always end up wanting to trap so many types of details anyway, you might as well put it 100% behind a cmdButton rather than trying to endlessly hook into events and/or use data macros.
I think best solution could be..


I used it, and it works very well.
 

Users who are viewing this thread

Back
Top Bottom