Private Sub cmdOk_Click()
If txtusername.Text = vbNullString Or txtpassword.Text = vbNullString Then
MsgBox "Unidentified user", vbExclamation, "Message Prompt"
txtusername.SetFocus
End If
Dim strSQL As String
strSQL = "SELECT * FROM tbluser WHERE Username LIKE '" & txtusername.Text & "' AND Password LIKE '" & txtpassword.Text & "'"
RST.Open strSQL, con, adOpenForwardOnly, adLockOptimistic
If RST.EOF = False Then
ActiveUserID = RST!ID 'ActiveUserID ay variable same po sa
ActiveUsername = RST!UserName 'ActiveUsername, ActivePassword, ActiveUsertype
ActivePassword = RST!Password 'Variable lang po yan.
ActiveUserType = RST!Access
Unload Me
MDIMain.Show
Else
MsgBox "You have entered Invalid Username or Password.", vbCritical, "Invalid Entry"
If MsgBox("Do you want to try again ?", vbQuestion + vbYesNo, "Invalid Entry") = vbYes Then
txtusername.Text = ""
txtpassword.Text = ""
txtusername.SetFocus
Else
Call cmdCancel_Click 'Dito nilagay ko lang con.Close , set con = nothing , End
End If
Set RST = Nothing
End If
End Sub
ITO lang po tapos pag katapos kong pindutin ung ENter mag cclose napo ung application.
Thank you po