Password mask **********

Access 97

Is there a way to change the following code so that when the user is prompted to enter a password, the typed entry does not show in clear, but rather as a typical password format?

Example:  

Current entry: “PASSWORD”
Desired entry: “********”

********** Code Starts **********

Private Sub Form_Open(Cancel As Integer)
Dim strPassword As String

strPassword = InputBox("This form is password-protected. Please enter the correct password below to access the form.", "Password Required")

If strPassword <> "PlacePasswordHere" Then
   MsgBox "That is an incorrect password: access has been denied.", vbInformation, "Access Denied"
   DoCmd.Quit acExit

End If

End Sub

********** Code Ends **********
DWBAsked:
Who is Participating?
 
JimMorganConnect With a Mentor Commented:
I'll see what I can do.
0
 
tomk120999Commented:
DWB, I think that there is a data type 'Password', which does just what you're looking for.  I'm at anothe computer right now, do I don't have access to Access.  Check it out in your on-line help.  If memory serves it is:
Dim strPassword as Password, but it's been a while.

good luck as usual...
0
 
JimMorganCommented:
There is no password data type.  Password property is for setting up a new password for user.

However there is a password input mask which does exactly what you want.

Click the field's Data tab > Input Mask > elipse > Password.

Whatever you type will show as a password (* instead of character) but the value will be what you typed in.

If the field is a bound field from a table, then put the input mask in the table to prevent anyone from seeing it.  If it is in code, put the input mask in the form.  I'd advise encrypting your DB so no one can see the password by debugging the DB.

Jim

0
The new generation of project management tools

With monday.com’s project management tool, you can see what everyone on your team is working in a single glance. Its intuitive dashboards are customizable, so you can create systems that work for you.

 
tomk120999Commented:
Thanks, Jim, couldn't remember!

good luck as usual...
0
 
JimMorganCommented:
Tom:  Don't want to give up all my secrets but when you don't remember, look it up!  Remember the Navy - No excuses, Sir! - ?
0
 
DWBAuthor Commented:
I tried but didn’t get very far, please have a look at the actual code below. I’ll change the password later regardless; I was unable to get the format correct.

'************************************
' PASSWORD
'--------------------------------------------------------------
' Prompt's the user for a password when they open the
' Main Menu form . If the correct password is entered, the
' form is opened. If Not Close and Exit the database.
'--------------------------------------------------------------

Private Sub Form_Open(Cancel As Integer)
Dim strPassword As String
strPassword = Format("*")   ' Returns "*******".

strPassword = InputBox("Well Woman's Clinic is password-protected. Please enter the correct password below to access this database.", "Password Required")

If strPassword <> "WWC246m" Then
   MsgBox "That is an incorrect password: access has been denied.", vbInformation, "Access Denied"
   DoCmd.Quit acExit

End If

End Sub
0
 
JimMorganCommented:
That is not what you want to do.  It will not work like that.

Before you open the main form, you should open a GetPassword Form which verifies that you have the correct password and then open the main form.

Create one unbound box and make that the password box.  That is the only box that you have on the form.

Set the box's Input Mask to Password.

In the After Update event put the code that checks the password.  Even though the user sees only *********, the value is the password entered.

If the password is correct then open the main form and close this one.

There are a lot more things to do to make this security proof but for now lets get that working.

In the meantime, you can hide both the password and the main form so no one can easily see them in the database and decide to open them.

Jim
0
 
DWBAuthor Commented:
I’m shutting down for the night, I just managed to screw up my database (copy only – learned that trick the hard way a while back).

I can’t get this one together with the code I have, so I tried to implement some different code and, well as they say the rest is history. I have no problem creating the form and the password formatted text box, but the rest, just isn’t in the cards.

Could you perhaps send a small sample database and/or a complete example of some kind, it would be greatly appreciated. I’ll provide you with all my points if you like, and I’ll struggle through until I gain more :--)

If you feel uncomfortable with that, not a problem, you’ve already provided a great deal of help.

I’ll check back in the morning, just prior to my wife screaming that I spend too much time on the computer.


Regards,

Dave
dbrydon@webhart.net


0
 
DWBAuthor Commented:
To be a King is great,
To serve thy king is greater,
To receive rewards and riches by thy king,
is beyond one’s riches dreams.

I am at your beckon call, Sir!

Or simply put: You’re the Greatest!

A hearty Bravo-Zulu
------
Tell me a hundred times and I may begin to learn.
Show me once and I’ll never forget.

A picture is truly worth a thousand words.

I truly appreciate your effort, Thank-you!

0
 
JimMorganCommented:
Give a man a fish and you feed him for a day.
Teach a man to fish and you feed him for life.

OJT - one of the best teachers in the world.

What is a 'beckon call'?  Is that the signal for Batman?  :-)

For those who don't know what the heck went on, I sent DWB a sample DB that had one form to enter the password.  If the password was correct, the form closed itself and opened the main form.  If not, it complained and then asked you to try again.

Jim
0
All Courses

From novice to tech pro — start learning today.