maixuanthu > 20-07-13, 12:31 AM
Private Sub cmddn_Click()
If Me.guest_login.Value = True Then
DoCmd.SetWarnings False
DoCmd.RunSQL "UPDATE user SET online=0 WHERE online=-1"
DoCmd.SetWarnings True
MsgBox "Chao ban. @Ban dang dang nhap voi tai khoan khach", vbInformation, "Thong bao"
DoCmd.Close
DoCmd.OpenForm "mainform"
Else
If IsNull(Me.username.Value) Then
MsgBox "Ban chua nhap ten truy cap", vbInformation, "Thong bao"
Me.username.SetFocus
ElseIf IsNull(Me.password.Value) Then
MsgBox "Ban chua nhap mat khau", vbInformation, "Thong bao"
Me.password.SetFocus
Else
If DCount("*", "user", "username='" & Me.username.Value & "'") > 0 Then
If Me.password.Value <> DLookup("password", "user", "username='" & Me.username.Value & "'") Then
Me.password.SetFocus
If saipass = 0 Then
MsgBox "Ban da dang nhap sai " & chophepsai & " lan lien tiep, chuong trinh tu dong thoat", vbInformation, "Thong bao"
DoCmd.Quit
Else
MsgBox "Mat khau khong chinh xac, vui long kiem tra lai" & Chr(13) & "Sau " & saipass & " lan sai chuong trinh tu dong thoat", vbInformation, "Thong bao"
saipass = saipass - 1
End If
ElseIf DLookup("enabled", "user", "username='" & Me.username.Value & "'") = 0 Then
MsgBox "Tai khoan nay hien dang bi cam truy cap. " & Chr(13) & "@ Vui long lien he voi Administrator de duoc mo lai tai khoan", vbInformation, "Thong bao"
Else
DoCmd.SetWarnings False
DoCmd.RunSQL "UPDATE user SET online=0 WHERE username <> '" & Me.username.Value & "' AND online =-1 "
DoCmd.RunSQL "UPDATE user SET online=-1 WHERE username='" & Me.username.Value & "'"
DoCmd.SetWarnings True
MsgBox "Chao " & DLookup("username", "user", "username='" & Me.username.Value & "'") & " .@ Chuc ban mot ngay tot lanh", vbInformation, "Chao mung"
DoCmd.Close
DoCmd.OpenForm "mainform"
End If
Else
Me.username.SetFocus
If saipass = 0 Then
MsgBox "Ban da dang nhap sai " & chophepsai & " lan lien tiep, chuong trinh tu dong thoat", vbInformation, "Thong bao"
DoCmd.Quit
Else
MsgBox "Ten truy cap khong chinh xac, vui long kiem tra lai" & Chr(13) & "Sau " & saipass & " lan sai chuong trinh tu dong thoat", vbInformation, "Thong bao"
saipass = saipass - 1
End If
End If
End If
End If
End Sub
cpucloi > 20-07-13, 08:35 AM
paulsteigel > 20-07-13, 01:19 PM
If Me.Password.Value <> DLookup("password", "user", "username='" & Me.UserName.Value & "'") Then
maixuanthu > 20-07-13, 07:06 PM
tt1212 > 20-07-13, 08:10 PM
maixuanthu > 20-07-13, 11:54 PM