Masking Passwords

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • UAlbanyMBA
    New Member
    • Nov 2006
    • 31

    Masking Passwords

    When trying to create a login page in access I am having trouble concealing the password. I have the table setup to accept password as text and masked as "*". In the form I have played around with having the password box show data in real characters or "*". It only works when I have the password box set to text, it provides me with errors if I have the textbox masked to "*"

    Any hints?

    Thanks
  • Rabbit
    Recognized Expert MVP
    • Jan 2007
    • 12517

    #2
    Set the Textbox's Input Mask Property to PASSWORD

    Comment

    • UAlbanyMBA
      New Member
      • Nov 2006
      • 31

      #3
      Thanks. Unfortunately doing this leads me to the errors I mentioned before. I am also having trouble with my query code, access says it cannot execute my query. Here is my code:

      Code:
      Private Sub Command6_Click()
      
          Dim usr As String
          txtUsername.SetFocus
          usr = txtUsername.Text
          
          Dim pass As String
          txtPassword.SetFocus
          pass = txtPassword.Text
          
          Dim strSQL As String
          strSQL = "SELECT Username, Password FROM LoginInfo WHERE ((LoginInfo.Username = '" & usr & "') AND (LoginInfo.Password = '" & pass & "'))"
          
          Dim dbs As DAO.Database
          Dim qdf As DAO.QueryDef
          
          Set dbs = CurrentDb
          
          dbs.QueryDefs.Delete ("Login")
          Set qdf = dbs.CreateQueryDef("Login", strSQL)
          dbs.Execute ("Login")
          dbs.QueryDefs.Delete ("Login")
          
          If (qdf.OpenRecordset.EOF) Then
              MsgBox ("Username and/or password is incorrect.")
          Else
              'Close an Inventory Form
              DoCmd.Close acForm, "LoginView", acSaveYes
          
              'Open an Employee Form in Edit Mode
              DoCmd.OpenForm "Main Menu", acNormal, , , acFormEdit, acWindowNormal
          End If
          
          dbs.QueryDefs.Delete ("Login")
      
      On Error GoTo Err_cmdExitForm_Click
      
      Exit_cmdExitForm_Click:
          Exit Sub
      
      Err_cmdExitForm_Click:
          MsgBox Err.Description, vbExclamation, "Error in LoginView_Close()"
          Resume Exit_cmdExitForm_Click
      End Sub
      Last edited by NeoPa; Mar 10 '07, 04:25 PM. Reason: Tags for Layout

      Comment

      • NeoPa
        Recognized Expert Moderator MVP
        • Oct 2006
        • 32633

        #4
        Please try to keep the thread on track.
        If this is a new, unrelated question, then it needs to be in its own thread.
        You will also need to rephrase it of course, as this is not a simple bug-fixing service. We are happy to answer specific questions, or to help where possible, but simply dumping a page of code to be 'fixed' is not the idea.

        Where are you with the password issue?
        What exactly is the problem you find when using 'PASSWORD' as the Input Mask?

        Comment

        • UAlbanyMBA
          New Member
          • Nov 2006
          • 31

          #5
          I'm sorry about my poor posting earlier, I didn't mean to form my question that way. When I switch the input mask to Password, I get my self programed error check, a message box popping up saying "invalid username/password"

          Thanks

          Comment

          • Denburt
            Recognized Expert Top Contributor
            • Mar 2007
            • 1356

            #6
            Remove your error message and tell us what the MS Access error is.

            msgbox err.number & " " & err.description

            Comment

            • Denburt
              Recognized Expert Top Contributor
              • Mar 2007
              • 1356

              #7
              Excuse my previous hasty post, always bsy.

              O.K. I reviewed you code from above and it needs a LOT of clean up.

              First whenever reffering to a control on a form you are currently in then you should always refer to it by using me!

              Such as: Me!txtPassword. SetFocus

              That will save you a lot of headaches.
              Next use the following:

              pass = Me!txtPassword

              instead of

              pass = Me!txtPassword. text

              That will give your variable the actual password and not just the mask.


              Next problem, you have the following:

              Code:
                Set dbs = CurrentDb
                  
                  dbs.QueryDefs.Delete ("Login")
                  Set qdf = dbs.CreateQueryDef("Login", strSQL)
                  dbs.Execute ("Login")
                  dbs.QueryDefs.Delete ("Login")
              change it to read

              Code:
               Set dbs = CurrentDb
               Set qdf = dbs.CreateQueryDef("Login", strSQL)
              Make sure the login query is deleted before you run this and you should be fine.

              Tried and tested good luck.
              Last edited by NeoPa; Mar 16 '07, 01:22 PM. Reason: Tags-

              Comment

              • UAlbanyMBA
                New Member
                • Nov 2006
                • 31

                #8
                The error doesn't come up unless I put up the message. It i just a ZERO or capital "O" not quite sure.

                Thanks

                Comment

                • NeoPa
                  Recognized Expert Moderator MVP
                  • Oct 2006
                  • 32633

                  #9
                  I'm not sure what you're trying to say here :o

                  Comment

                  • UAlbanyMBA
                    New Member
                    • Nov 2006
                    • 31

                    #10
                    It works!!!!! THANK YOU SO VERY MUCH!!!!!!!!!!! ! :)

                    Comment

                    • NeoPa
                      Recognized Expert Moderator MVP
                      • Oct 2006
                      • 32633

                      #11
                      :)
                      I'm not sure what changed so much in the mean time, but it's always nice to 'hear' a happy response.
                      One for denburt I think.

                      Comment

                      • Denburt
                        Recognized Expert Top Contributor
                        • Mar 2007
                        • 1356

                        #12
                        Thanks, WTG glad it is working! :)

                        Comment

                        • NeoPa
                          Recognized Expert Moderator MVP
                          • Oct 2006
                          • 32633

                          #13
                          By the way.
                          I'm creating a new thread for this discussion to avoid hijacking this one. Once it's properly sorted out I will delete the posts not relevant to each thread.
                          This thread should remain on topic from now then, and the other thread is Referencing Controls on a Form.

                          Comment

                          Working...