Anda di halaman 1dari 1

Private Sub CmdLogin_Click()

Set sh = Sheets(1)
If TxtUser.Value = "" Then
MsgBox "Silahkan Masukkan User Name", vbExclamation + vbOKOnly, "Blank User
Name"
TxtUser.SetFocus
Exit Sub
ElseIf TxtPswd.Value = "" Then
MsgBox "Silahkan Masukkan Password", vbExclamation + vbOKOnly, "Blank Password"
TxtPswd.SetFocus
Exit Sub
ElseIf TxtUser.Value <> sh.Range("A2").Value Then
MsgBox "User Name Salah/Tidak Terdaftar", vbCritical + vbOKOnly, "Error User Name"
TxtUser.SetFocus
Exit Sub
ElseIf TxtPswd.Value <> sh.Range("B2").Value Then
MsgBox "Password Salah, Silahkan ulangi lagi", vbCritical + vbOKOnly, "Error Password"
TxtPswd.SetFocus
Exit Sub
End If
MsgBox "Selamat Anda berhasil Login", vbInformation + vbOKOnly, "Login Sukses"
Unload Me
Sheets(2).Activate
End Sub
Private Sub CmdCancel_Click()
Unload Me
End Sub