VB - Input Box Password Help

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • INeedHelpPlease
    New Member
    • May 2010
    • 2

    #1

    VB - Input Box Password Help

    I have successfully created a password input box on a command button however when you type in the password it is all shown until you press enter. Is there any way that i can change the below code so that when typing in my password it changes it to a *?? for example i type my first letter in "s" then when i enter the next letter in the previous one changes to *??

    Thanks in advance.
    Code:
    Private Sub othrps_Click()
    'Attached to On Click event of othrps
    
        Dim strPasswd
    
        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 "Operation Cancelled", 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 = "Sugar" Then
            DoCmd.OpenForm "frm_other_reports", acNormal
        Else
            MsgBox "Sorry, you do not have the required permission to access this area", _
                   vbOKOnly, "Important Information"
            Exit Sub
        End If
    End Sub
    Last edited by NeoPa; May 19 '10, 03:55 PM. Reason: Please use the [CODE] tags provided.
  • NeoPa
    Recognized Expert Moderator MVP
    • Oct 2006
    • 32669

    #2
    Set the Input Mask of the control to Password. No quotes. Just the text.

    Comment

    • missinglinq
      Recognized Expert Specialist
      • Nov 2006
      • 3533

      #3
      NeoPa, can you do that when using InputBox? I thought you'd have to used a small popup form in place of the InputBox.

      Linq ;0)>

      Comment

      • NeoPa
        Recognized Expert Moderator MVP
        • Oct 2006
        • 32669

        #4
        You're right of course Linq.

        I would suggest an alternative of creating a form to get your password from the operator. Forms can be made to be very similar to the InputBox windows if you feel that's required.

        Comment

        Working...