Delete Current Record With Password (2 Viewers)

smtazulislam

Member
Local time
Today, 13:39
Joined
Mar 27, 2020
Messages
236
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.
 

Gasman

Enthusiastic Amateur
Local time
Today, 10:39
Joined
Sep 21, 2011
Messages
7,115
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.?
 

Isaac

Lifelong Learner
Local time
Today, 02:39
Joined
Mar 14, 2017
Messages
2,701
@Gasman thanks for the assist.
 

smtazulislam

Member
Local time
Today, 13:39
Joined
Mar 27, 2020
Messages
236
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

  • DeletePassSet.accdb
    668 KB · Views: 12

Gasman

Enthusiastic Amateur
Local time
Today, 10:39
Joined
Sep 21, 2011
Messages
7,115
: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.
 

Isaac

Lifelong Learner
Local time
Today, 02:39
Joined
Mar 14, 2017
Messages
2,701
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.
 

theDBguy

I’m here to help
Staff member
Local time
Today, 02:39
Joined
Oct 29, 2018
Messages
13,187
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:

Isaac

Lifelong Learner
Local time
Today, 02:39
Joined
Mar 14, 2017
Messages
2,701
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.
 

asadkhan

Registered User.
Local time
Today, 10:39
Joined
Oct 26, 2019
Messages
35
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

Top Bottom