Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Data Bases > Visual Dbase > LostFocus Event...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 1 of 4 Topic 38 of 131
Post > Topic >>

LostFocus Event help

by "Randi" <RSaddler@[EMAIL PROTECTED] > Dec 14, 2003 at 06:10 AM

Hi All,
I have a problem on a username password login form.  I use:
txtPassword.Text = StrConv(txtPassword.Text, vbProperCase) to validate the
proper case when someone enters their name and password.  It work when you
use the button to continue, but if you hit enter on your keyboard the
event
apparently doesnt lose focus and it says you entered the wrong password. 
Is
there an easy fix for this.  I pointed out the problem code below.  Any
help
would be appreciated.

Thanks,
Kelsey

Option Explicit

Public LoginSucceeded As Boolean

Private Sub cmdCancel_Click()
    'set the global var to false
    'to denote a failed login
    LoginSucceeded = False
    Unload Me
End Sub

Private Sub cmdOK_Click()
    Dim db As Database
    Dim rs As DAO.Recordset

    Set db = OpenDatabase(App.Path & "\testlogin.mdb")
    Set rs = db.OpenRecordset("login")

    Do While Not rs.EOF
        If txtUserName.Text = "Guest" And txtPassword.Text = "Guest" Then
        Guest.Show
        Exit Sub
        End If
        If rs.Fields("username") = (txtUserName.Text) And _
        rs.Fields("password") = (txtPassword.Text) Then
        Form1.Show
        Unload Me
        Exit Sub
    Else
        rs.MoveNext
        End If
    Loop
    txtPassword.Text = ""
    MsgBox "Incorrect Password!", vbCritical
End Sub
Private Sub txtPassword_LostFocus() <--------Here
txtPassword.Text = StrConv(txtPassword.Text, vbProperCase)
End Sub

Private Sub txtUserName_LostFocus()
txtUserName.Text = StrConv(txtUserName.Text, vbProperCase)
End Sub


Private Sub frmLogin_Load()
    Data1.DatabaseName = (App.Path & "\testlogin.mdb")
    Data1.RecordSource = "login"
End Sub
 




 4 Posts in Topic:
LostFocus Event help
"Randi" <RSa  2003-12-14 06:10:57 
Re: LostFocus Event help
"BeastFish" <  2003-12-14 02:49:10 
Re: LostFocus Event help
butlerbob@[EMAIL PROTECTE  2003-12-14 07:10:36 
Re: LostFocus Event help
"Steve Gerrard"  2003-12-14 10:53:07 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan13V112 Thu Jul 24 14:25:00 CDT 2008.