Password textbox autotab

A

Antonio

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
 
J

Jonathan Parminter

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top