I have set a password with "on click", how do I show "*" when entering it (1 Viewer)

hardhitter06

Registered User.
Local time
Today, 03:50
Joined
Dec 21, 2006
Messages
600
I have set a password with "on click", how do I show "*" when entering it

Hi All,

I created a password "josh" on one of my form buttons on click property. How do I encrpyt it (I hope im using the right terminology) when someone clicks the button and begins typing the password.

In other words, they click the button, the password input window displays, when typing in the password to go to the next form, how do i get it to show as "****" instead of "josh" when they input???

Here is my code:

Code:
Private Sub Search_Click()
 'Attached to On Click event of cmdOpenEmpForm

    Dim strPasswd
    Dim stDocName As String
    Dim stLinkCriteria As String
    
    stDocName = "frmAdminSearch"
    

    strPasswd = InputBox("Enter Password", "Restricted Form")

    'Check to see if there is any entry made to input box, or if
    'cancel button is pressed. If no entry made then exit sub.

    If strPasswd = "" Or strPasswd = Empty Then
        MsgBox "No Input Provided", vbInformation, "Required Data"
        Exit Sub
    End If

    'If correct password is entered open Employees form
    'If incorrect password entered give message and exit sub

    If strPasswd = "josh" Then
    DoCmd.OpenForm stDocName, , , stLinkCriteria
  
    Else
        MsgBox "Sorry, you do not have access to this form", _
               vbOKOnly, "Important Information"
        Exit Sub
    End If
    
End Sub

Thank you.
 

JamesMcS

Keyboard-Chair Interface
Local time
Today, 08:50
Joined
Sep 7, 2009
Messages
1,819
Re: I have set a password with "on click", how do I show "*" when entering it

I think you need to use an input mask - I think there's even an option for it in the text box's properties in form design view.
 

hardhitter06

Registered User.
Local time
Today, 03:50
Joined
Dec 21, 2006
Messages
600
Re: I have set a password with "on click", how do I show "*" when entering it

Access has a "restricted form" dialog box that pops up when I hit the button to enter the password. I dont believe i have access to the properties for that Access Dialog Box. I think I would have to add something to my code in order for it to hide the characters as I type them in...?
 

JamesMcS

Keyboard-Chair Interface
Local time
Today, 08:50
Joined
Sep 7, 2009
Messages
1,819
Re: I have set a password with "on click", how do I show "*" when entering it

Yeah but that would be something of a nightmare - can you upload a stripped out DB so I can have a look at this restricted form busienss? A new one on me....
 

JamesMcS

Keyboard-Chair Interface
Local time
Today, 08:50
Joined
Sep 7, 2009
Messages
1,819
Re: I have set a password with "on click", how do I show "*" when entering it

Oh I see.... not a form but an input box. Sorry! Er how about
Code:
strPasswd = format(InputBox("Enter Password", "Restricted Form"),"Password")
A total guess but you never know...

The only other option is to bin off the inputbox altogether and have it as a form. Then you can set the input mask and jobs a goodun
 

hardhitter06

Registered User.
Local time
Today, 03:50
Joined
Dec 21, 2006
Messages
600
Re: I have set a password with "on click", how do I show "*" when entering it

Well that code didn't do anything. Some part of the code will need a "*" to let it know thats what you want to type as a replacement for the characters.

I could use a text box and have it work with the command button but I'd rather not do that. There has to be a way to write this in the code
 

JamesMcS

Keyboard-Chair Interface
Local time
Today, 08:50
Joined
Sep 7, 2009
Messages
1,819
Re: I have set a password with "on click", how do I show "*" when entering it

It was only a guess. You could try substituting password with * but I doubt that'll work either.

Yeah that's your code isn't it? I think what the guy is saying about a pop up form rather than an inputbox, as per my previous post, is the only way to go...
 

boblarson

Smeghead
Local time
Today, 00:50
Joined
Jan 12, 2001
Messages
32,059
Re: I have set a password with "on click", how do I show "*" when entering it

Check this thread out. You can use this code provided in a standard module and then use InputBoxDK instead of InputBox and it will mask your password.
 

hardhitter06

Registered User.
Local time
Today, 03:50
Joined
Dec 21, 2006
Messages
600
Re: I have set a password with "on click", how do I show "*" when entering it

Am i suppose to copy all that code and replace it with mine, or do I just need a piece of it?
 

boblarson

Smeghead
Local time
Today, 00:50
Joined
Jan 12, 2001
Messages
32,059
Re: I have set a password with "on click", how do I show "*" when entering it

That code is in ADDITION to yours and then you need to change your code to use the InputBoxDK instead of InputBox. The code in that thread needs to go into a standard module (remember not to name it the same as any of the functions).
 

hardhitter06

Registered User.
Local time
Today, 03:50
Joined
Dec 21, 2006
Messages
600
Re: I have set a password with "on click", how do I show "*" when entering it

What is standard module?
 

hardhitter06

Registered User.
Local time
Today, 03:50
Joined
Dec 21, 2006
Messages
600
Re: I have set a password with "on click", how do I show "*" when entering it

I got it. Never had to do something like that. Awesome Bob!!
 

eburgtech

Jack of All Trades
Local time
Today, 00:50
Joined
Apr 22, 2010
Messages
27
Re: I have set a password with "on click", how do I show "*" when entering it

I tried using this but my button errors out every time, bringing up the debugger and stopping on the button name in the VBA code and highlights the InputBoxDK in the code. Any ideas?
 

boblarson

Smeghead
Local time
Today, 00:50
Joined
Jan 12, 2001
Messages
32,059
Re: I have set a password with "on click", how do I show "*" when entering it

What is the error message (exactly)?
 

eburgtech

Jack of All Trades
Local time
Today, 00:50
Joined
Apr 22, 2010
Messages
27
Re: I have set a password with "on click", how do I show "*" when entering it

Nevermind. Figured it out. I had to call the function. Derrr. lol
 

Users who are viewing this thread

Top Bottom