[Whiz]~Czechoslovakia Admin
Number of posts : 111 Age : 34 Location : Antipolo City Job/hobbies : Web Page Designing, Flash Animation, Software Modification, Image Editing, Gathering Intelligence, T Registration date : 2008-04-12
| Subject: sample sql T_T Fri Nov 28, 2008 2:06 pm | |
| Option Explicit
Public LoginSucceeded As Boolean ----------------------------------------------------- Private Sub cmdCancel_Click() 'set the global var to false 'to denote a failed login LoginSucceeded = False Me.Hide End Sub --------------------------------------------------------- Private Sub cmdOK_Click() 'check for any record, if there is no record there could be error when looping If Data1.Recordset.RecordCount = 0 Then MsgBox ("No recordset") Exit Sub End If 'check for correct username and password Data1.Recordset.MoveFirst Do While Not Data1.Recordset.EOF If txtUserName = Data1.Recordset.Fields("Username") Then If txtPassword = Data1.Recordset.Fields("Password") Then LoginSucceeded = True Me.Hide Form1.Show End If End If Data1.Recordset.MoveNext Loop If Not LoginSucceeded Then MsgBox "Invalid UserName/Password, try again!", , "Login" txtPassword.SetFocus SendKeys "{Home}+{End}" End If End Sub | |
|