• DİKKAT

    DOSYA İndirmek/Yüklemek için ÜCRETLİ ALTIN ÜYELİK Gereklidir!
    Altın Üyelik Hakkında Bilgi

Veritabanında İkinci Kayıt Sorunu

Katılım
13 Ocak 2008
Mesajlar
142
Excel Vers. ve Dili
2003 office
Arkadaşlar bir adet personel dosyam var bu dosyada personel numarasına göre personel kayıt işlemi yapıyorum.
Kod:
Private Sub CommandButton1_Click()
Set s1 = Sheets("VERİ")
If ComboBox1.Text = "" Then
MsgBox "Lütfen T.C Kimlik No.sunu Yazınız!!!"
Exit Sub
End If
 
Sheets("VERİ").Select

e = s1.[a65536].End(3).Row
Cells(e + 1, "A") = ComboBox1.Text
Cells(e + 1, "B") = TextBox1.Text
Cells(e + 1, "C") = TextBox2.Text
Cells(e + 1, "D") = TextBox3.Text

TextBox1.Text = ""
TextBox2.Text = ""
TextBox3.Text = ""
End Sub

İstediğim şey A sütununda daha önceden yazdığım personel numarası var ise kişiyi tekrar kayıt etmesin yani aynı personel numarası ile iki kişi kayıt edilemesin.

Dosya Ektedir.
 

Ekli dosyalar

Merhaba,

Kodları aşağıdakilerle değiştiriniz..

Kod:
Private Sub CommandButton1_Click()

If ComboBox1.Text = "" Then
    MsgBox "Lütfen T.C Kimlik No.sunu Yazınız!!!"
    Exit Sub
End If
 
Sheets("VERİ").Select
e = [a65536].End(3).Row + 1
 
If WorksheetFunction.CountIf([A:A], ComboBox1.Value) > 0 Then
    MsgBox "Bu veri Kayıtlı"
    Temizle
    Exit Sub
Else
    Cells(e, "A") = ComboBox1.Text
    Cells(e, "B") = TextBox1.Text
    Cells(e, "C") = TextBox2.Text
    Cells(e, "D") = TextBox3.Text
End If

Temizle

End Sub
 
Private Sub Temizle()
    TextBox1.Text = ""
    TextBox2.Text = ""
    TextBox3.Text = ""
End Sub

.
 
Geri
Üst