file.vb
Private Sub cmdok_Click()
Static y As Integer
Adodc1.Refresh
With Adodc1.Recordset
If .RecordCount > 0 Then
If .EOF = False Then
.MoveFirst
If !UserName = txtUsername And !Password = txtPassword Then
MsgBox "Login Successful!"
frmMenu.Show
Unload Me
Else
MsgBox "Invalid username/password!", vbOKOnly + vbCritical, "Access denied!"
txtUsername.Text = ""
txtPassword.Text = ""
txtUsername.SetFocus
End If
End If
End If
End With
End Sub