How can I give a command button a password. Such as a delete button that needs a password before you can use it. I also would like to know how to input a electronic signature to a report.
U could do something simple like Inputbox() with a hard-coded value before proceeding with the delete action. Or, use the Inputbox() to get a user response and seearch for a valid password for that user in a user database table. Hard-coded example listed below... htwh..
BRanswer = InputBox(BRMsg, BRTitle, Defvalue) ' Get user input.
If BRanswer = "password" Then
'Do the delete action here
Else
Exit Sub
Endif
Steve Medvid
"IT Consultant & Web Master"
it works but I am having trouble setting the password I want I think I might be missing something. I put the code in with my code for the delete button. do I need another field for the password it self?
Dim BRanswer as String
Dim BRMsg as String
Dim BRTitle as String
Dim Defvalue as String
BRanswer=""
BRMsg="Enter Password for Delete"
BRTitle="Title Here"
Defvalue="" 'Default Value - U most likely will not use...
If BRanswer = "password" Then
'Do the delete action here
'Where "password" is the Hard-Coded value! Can be anything u make it.
Else
Exit Sub
Endif Steve Medvid
"IT Consultant & Web Master"
Thank you very much it works great. In the future I would like to have it look up passwords in the database this way I can assign a password for each person is there a way to do this? again thank you much for the help
It is working great, but I need to know one more thing, How can I mask the password like this (******) so no one can see what it is again thank you much for the help
I don't think you can apply a mask to the InputBox(). Another approach would be to create a little modal form with a text box to accept the password entry. At this point you are adding an additional layer of complexity. If the true purpose of having a password entered is to permit the user to think about deleting the record, then just use the Inputbox() method as opposed to a password form.
The better approach would be to have a login page to capture a user name/password then check a database table which has what rights a user has. For example, they can delete records from one form/table, but not others. Then before the delete action is executed, check the user rights table to see if they have permission to perform the delete.
It really depends if you are building a tool or a system.
htwh... Steve Medvid
"IT Consultant & Web Master"
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.