By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,376 Members | 3,024 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,376 IT Pros & Developers. It's quick & easy.

Masking Passwords

P: 31
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
Mar 9 '07 #1
Share this Question
Share on Google+
12 Replies


Rabbit
Expert Mod 10K+
P: 12,366
Set the Textbox's Input Mask Property to PASSWORD
Mar 9 '07 #2

P: 31
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:

Expand|Select|Wrap|Line Numbers
  1. Private Sub Command6_Click()
  2.  
  3.     Dim usr As String
  4.     txtUsername.SetFocus
  5.     usr = txtUsername.Text
  6.  
  7.     Dim pass As String
  8.     txtPassword.SetFocus
  9.     pass = txtPassword.Text
  10.  
  11.     Dim strSQL As String
  12.     strSQL = "SELECT Username, Password FROM LoginInfo WHERE ((LoginInfo.Username = '" & usr & "') AND (LoginInfo.Password = '" & pass & "'))"
  13.  
  14.     Dim dbs As DAO.Database
  15.     Dim qdf As DAO.QueryDef
  16.  
  17.     Set dbs = CurrentDb
  18.  
  19.     dbs.QueryDefs.Delete ("Login")
  20.     Set qdf = dbs.CreateQueryDef("Login", strSQL)
  21.     dbs.Execute ("Login")
  22.     dbs.QueryDefs.Delete ("Login")
  23.  
  24.     If (qdf.OpenRecordset.EOF) Then
  25.         MsgBox ("Username and/or password is incorrect.")
  26.     Else
  27.         'Close an Inventory Form
  28.         DoCmd.Close acForm, "LoginView", acSaveYes
  29.  
  30.         'Open an Employee Form in Edit Mode
  31.         DoCmd.OpenForm "Main Menu", acNormal, , , acFormEdit, acWindowNormal
  32.     End If
  33.  
  34.     dbs.QueryDefs.Delete ("Login")
  35.  
  36. On Error GoTo Err_cmdExitForm_Click
  37.  
  38. Exit_cmdExitForm_Click:
  39.     Exit Sub
  40.  
  41. Err_cmdExitForm_Click:
  42.     MsgBox Err.Description, vbExclamation, "Error in LoginView_Close()"
  43.     Resume Exit_cmdExitForm_Click
  44. End Sub
Mar 9 '07 #3

NeoPa
Expert Mod 15k+
P: 31,494
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?
Mar 10 '07 #4

P: 31
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
Mar 15 '07 #5

Denburt
Expert 100+
P: 1,356
Remove your error message and tell us what the MS Access error is.

msgbox err.number & " " & err.description
Mar 15 '07 #6

Denburt
Expert 100+
P: 1,356
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:

Expand|Select|Wrap|Line Numbers
  1.   Set dbs = CurrentDb
  2.  
  3.     dbs.QueryDefs.Delete ("Login")
  4.     Set qdf = dbs.CreateQueryDef("Login", strSQL)
  5.     dbs.Execute ("Login")
  6.     dbs.QueryDefs.Delete ("Login")
change it to read

Expand|Select|Wrap|Line Numbers
  1.  Set dbs = CurrentDb
  2.  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.
Mar 15 '07 #7

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

Thanks
Mar 15 '07 #8

NeoPa
Expert Mod 15k+
P: 31,494
I'm not sure what you're trying to say here :o
Mar 16 '07 #9

P: 31
It works!!!!! THANK YOU SO VERY MUCH!!!!!!!!!!!! :)
Mar 16 '07 #10

NeoPa
Expert Mod 15k+
P: 31,494
:)
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.
Mar 16 '07 #11

Denburt
Expert 100+
P: 1,356
Thanks, WTG glad it is working! :)
Mar 16 '07 #12

NeoPa
Expert Mod 15k+
P: 31,494
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.
Mar 16 '07 #13

Post your reply

Sign in to post your reply or Sign up for a free account.