Private Sub Komut1_Click()
Dim UserLevel As Integer
If IsNull(Me.txtLoginID) Then
MsgBox "Lütfen kullanıcı adı giriniz", vbInformation, "Kullanıcı Adı Gereklidir"
Me.txtLoginID.SetFocus
ElseIf IsNull(Me.txtPassword) Then
MsgBox "Lütfen şifre giriniz", vbInformation, "Şifre Gereklidir"
Me.txtPassword.SetFocus
Else
If (IsNull(DLookup("[CalisanAd]", "tblsifre", "[CalisanAd] ='" & Me.txtLoginID.Value & "'"))) Or _
(IsNull(DLookup("[Password]", "tblsifre", "[Password] ='" & Me.txtPassword.Value & "'"))) Then
MsgBox "Kullanıcı Adı veya Şifre Yanlış"
Else
UserLevel = Dlookup ("UserSecurity", "tblsifre", "CalisanAd = '" & Me.txtLoginID.Value & "'")
DoCmd.Close
If UserLevel = 2 Then
DoCmd.OpenForm "Ana Menü"
ElseIf Not UserLevel = 2 Then
MsgBox "Buraya Giriş İçin Yetkiniz Yok", vbInformation, "Yetkisiz Giriş"
End If
End If
End If
End Sub