Password textbox autotab

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Good morning everybody...Here's my question:
On my login form, I would like users to enter their password and, when the
password typed is correct and it reached the length of the password stored in
the table, I would like to set the focus to another control automatically
without having the user click or tab to another control. With the code
below, it only works with the first record stored in the table. This is what
I have:

Dim intGoodPW As Integer
Dim intCurrentPW As Integer
Dim strCurrentPW As String
Dim strGoodPW As String

strGoodPW = Password
intGoodPW = Len(strGoodPW)
strCurrentPW = txtPassword.Text
intCurrentPW = Len(strCurrentPW)

If intCurrentPW = intGoodPW Then
If txtPassword.Text = DLookup _
("Password", "tblLogin", "[UserName]='" & Me.Username & "'") Then
cmdOK.SetFocus
MsgBox "Password length=" & intGoodPW & vbCrLf & _
"Current Password length=" & intCurrentPW
Else
'leave here
End If
End If
 
Antonio wrote...
-----Original Message-----
Good morning everybody...Here's my question:
On my login form, I would like users to enter their password and, when the
password typed is correct and it reached the length of the password stored in
the table, I would like to set the focus to another control automatically
without having the user click or tab to another control.

Hi Antonio,
if the length of the password is fixed, have you tried
setting an input mask to the required length and then set
the property Auto Tab to yes?

Luck
Jonathan
 
Back
Top