AccessTr.neT

Tam Versiyon: Vba Giriş Kısmında Kullanıcı Adı Ve Şifre Girişinde Hata Varsa Uyarı Alma
Şu anda arşiv modunu görüntülemektesiniz. Tam versiyonu görüntülemek için buraya tıklayınız.
İyi Çalışmalar Vba programında girişte kullanıcı adı ve şifre yanlış girildiğinde MsgBox ile uyarı almak istiyorum kodların yazıldığı yere atıyor buda problem oluşturuyor. Yardımcı Olabilirmisiniz.



Private Sub Image1_click()

user = Me.TextBox1
pass = Me.TextBox2

If user = "admin" Then
Application.Visible = True
Me.Hide
Exit Sub
End If

Call connection_open

sql1 = "select [ŞİFRE],[AD SOYAD],[SİCİL NO] from personel where [ID]='" & user & "'"
rs.Open sql1, conn, adOpenKeyset, adLockPessimistic
If Not rs.EOF And Not rs.BOF Then
     
     
adsoyad = rs.Fields(1) & "-Sicil No:" & rs.Fields(2)
anaformm.Label9.Caption = adsoyad
      If rs.Fields(0) = pass Then
      MsgBox "Giriş Başarılı"
      Me.Hide
      rs.Close
      conn.Close
      yükleniyor.Show
      Else
      MsgBox "Giriş başarısız. Kullanıcı Adınızı veya Parolanızı Kontrol Edin."
      End If
     
End If

End Sub

Private Sub TextBox1_MouseDown(ByVal Button As Integer, ByVal Shift As Integer, ByVal X As Single, ByVal Y As Single)
Me.TextBox1.Text = vbNullString

End Sub





Private Sub TextBox2_MouseDown(ByVal Button As Integer, ByVal Shift As Integer, ByVal X As Single, ByVal Y As Single)
Me.TextBox2.Text = vbNullString
End Sub



Private Sub UserForm_Initialize()
Application.Visible = False
End Sub
Private Sub Image1_click()

user = Me.TextBox1
pass = Me.TextBox2

If user = "admin" Then
Application.Visible = True
Me.Hide
Exit Sub
End If

Call connection_open

sql1 = "select [ŞİFRE],[AD SOYAD],[SİCİL NO] from personel where [ID]='" & user & "'"
rs.Open sql1, conn, adOpenKeyset, adLockPessimistic
If Not rs.EOF And Not rs.BOF Then
   
   
adsoyad = rs.Fields(1) & "-Sicil No:" & rs.Fields(2)
anaformm.Label9.Caption = adsoyad
      If rs.Fields(0) = pass Then
      MsgBox "Giriş Başarılı"
      Me.Hide
      rs.Close
      conn.Close
      yükleniyor.Show
      Else
     
      End If
   
End If
MsgBox "Giriş başarısız. Kullanıcı Adınızı veya Parolanızı Kontrol Edin."
End Sub

Private Sub TextBox1_MouseDown(ByVal Button As Integer, ByVal Shift As Integer, ByVal X As Single, ByVal Y As Single)
Me.TextBox1.Text = vbNullString

End Sub





Private Sub TextBox2_MouseDown(ByVal Button As Integer, ByVal Shift As Integer, ByVal X As Single, ByVal Y As Single)
Me.TextBox2.Text = vbNullString
End Sub



Private Sub UserForm_Initialize()
Application.Visible = False
End Sub


Sorun çözüldü çalışan kod yukarıda