Tam senin istediğin gibi oldu. Sifre formundaki Command2 butonunun tıklandığında olayındaki kodların yerine aşağıdaki kodları yerleştir:
Kod:
Private Sub Command2_Click()
Dim SifreKontrol As String
SifreKontrol = DLookup("Sifre", "tblsifre", "[ID]=" & Me.kullanıcı.Value)
'Girilen kullanıcı adı ve sifreyi "tblsifre" tablosundan kontrol et
If IsNull(Me.kullanıcı) Or Me.kullanıcı = "" Then
MsgBox "Lutfen Kullanıcı Adı Giriniz.", vbCritical, "CSKN CKL"
Me.kullanıcı.SetFocus
Exit Sub
End If
If IsNull(Me.Sifre) Or Me.Sifre = "" Then
MsgBox "Lutfen Şifre Giriniz.", vbCritical, "CSKN CKL"
Me.Sifre.SetFocus
Exit Sub
End If
'Eger Kullanıcı 3 kez yanlıs islem yaparsa programı kapat
intLogonAttempts = intLogonAttempts + 1
If intLogonAttempts > 3 Then
MsgBox "Sisteme giris icin uygun kod ve Sifre üretilemedi.", vbCritical, "CSKN CKL"
Application.Quit
End If
If Me.Sifre.Value = SifreKontrol Then
YetkiKontrol
Else
MsgBox "Hatalı Sifre! Lütfen Tekrar Deneyiniz", vbCritical, "CSKN CKL"
Me.Sifre.SetFocus
End If
End Sub
Private Function YetkiKontrol()
Dim Yetkili As String
Yetkili = DLookup("Yetki", "tblsifre", "[ID]=" & Me.kullanıcı.Value)
If Yetkili = "ADMINISTRATOR" Then
DoCmd.Close acForm, "sifre"
MsgBox "Admin olarak giriş yaptınız. Denetim Masasına yönlendiriliyorsunuz.", vbInformation, "Lütfen Dikkat..."
DoCmd.OpenForm "Denetim Masası"
Else
DoCmd.Close acForm, "sifre"
MsgBox "Sisteme Kısıtlı Kullanıcı olarak giriş yaptınız. Raporlama formuna yönlendiriliyorsunuz.", vbInformation, "Lütfen Dikkat..."
DoCmd.OpenForm "frmGecisFormu"
End If
End Function