• DİKKAT

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

Soru Access veri tabanına koşullu veri kaydetme?

Katılım
12 Ocak 2009
Mesajlar
838
Excel Vers. ve Dili
2003
Merhaba arkadaşlar.
Aşağıdaki kodda güncelleme modülünde çalışan şartlı kaydetme yeni kayıt modülünde çalışmıyor. Sorunun kaynağını çözemedim.
Kod:
Private Sub cmdKAYDET_Click()
If Not FrameTest Then Exit Sub
If OptionButton1.Value = True Then 'Yeni Kayıt

Set baglan = CreateObject("adodb.connection")
Set rs = CreateObject("adodb.recordset")
Call BAGLANTI

If ComboBox1.Text = "" Then
ComboBox1.SetFocus
MsgBox ("Lütfen Talebin Geldiği Birimi Seçin ..."), vbInformation, "Süleyman SAVAŞ"
Exit Sub
End If
 
rs.Open "select top 1 * from talep_takip ", baglan, 1, 2
rs.AddNew
rs("talep_no") = TextBox1.Text
rs("talebi_yapan_birim") = ComboBox1.Value
rs("talebin_turu") = ComboBox2.Value
rs("talebin_konusu") = TextBox2.Value
rs("talebin_barkod_numarasi") = TextBox3.Value
rs("talebin_gelis_tarihi") = TextBox4.Value
rs("talebin_gelis_yontemi") = TextBox5.Value

If TextBox6.Value = False Then
rs("talep_sonucu") = "Satınalmaya Gitmedi"
End If

rs("islem_tarihi") = tarih.Value
rs("kullanici") = Sheets("AYARLAR").Range("AY1")
rs("pc_adi") = pc_adi.Value
rs("local_ip") = local_ip.Value
rs("mac_adresi") = mac_adr.Value
rs.Update

 
MsgBox TextBox2 & " adlı kayıt başarı ile yapıldı.", , "Süleyman SAVAŞ"

rs.Close
temizle
listeye_al
End If

If OptionButton2.Value = True Then 'Güncelle
If TextBox2.Text = "" Then
TextBox2.SetFocus
MsgBox ("Lütfen Listeden çift tık ile kayıt seçin ..."), vbInformation, "Süleyman SAVAŞ"
Exit Sub
End If

Set baglan = CreateObject("adodb.connection")
Set rs = CreateObject("adodb.recordset")
Call BAGLANTI
    rs.Open "select * from talep_takip where talep_takip.KIMLIK like '%" & txKimlik.Text & "%'", baglan, 1, 2

If rs.RecordCount > 0 Then
rs("talep_no") = TextBox1.Text
rs("talebi_yapan_birim") = ComboBox1.Value
rs("talebin_turu") = ComboBox2.Value
rs("talebin_konusu") = TextBox2.Value
rs("talebin_barkod_numarasi") = TextBox3.Value
rs("talebin_gelis_tarihi") = TextBox4.Value
rs("talebin_gelis_yontemi") = TextBox5.Value
rs("talebin_satinalmaya_gidis_tarihi") = TextBox6.Value

If TextBox6.Value = True Then
rs("talep_sonucu") = "Satınalmaya Gitti"
End If

rs("talebin_satinalmaya_gidis_yontemi") = TextBox7.Value
rs("talebin_satinalmaya_gidis_barkodu") = TextBox8.Value
rs("talebin_neticesi") = ComboBox3.Value
rs("talebin_satinalma_sonuclanma_tarihi") = TextBox10.Value

 
rs("islem_tarihi") = tarih.Value
rs("kullanici") = Sheets("AYARLAR").Range("AY1")
rs("pc_adi") = pc_adi.Value
rs("local_ip") = local_ip.Value
rs("mac_adresi") = mac_adr.Value

    rs.Update
    MsgBox TextBox2 & " adlı kayıt başarı ile güncellendi.", , "Süleyman SAVAŞ"
End If
    rs.Close
    listeye_al
    temizle
End If

If OptionButton3.Value = True Then 'Sil
'If Label58 = "2" Then
'MsgBox ("Kısıtlı kullanıcılar işlem yapamaz")
'Exit Sub
'End If
On Local Error Resume Next
Dim nosil As Integer
Dim perno As String

If txKimlik = "" Then
    MsgBox "Önce listeden çift tıklayarak bir veri seçin.", vbCritical + vbOKOnly, "Süleyman SAVAŞ"
    Exit Sub
End If

Dim kimlik As Integer
kimlik = txKimlik

perno = UserForm1.Controls("txKimlik").Value
sor = MsgBox(TextBox2 & " isimli kayıt silinecek. " & Chr(10) & "Devam edeyim mi ?", vbYesNo + vbCritical + vbDefaultButton2, "Dikkat")
If sor = vbNo Then Exit Sub

Call BAGLANTI
Set rs = baglan.Execute("DELETE FROM talep_takip WHERE KIMLIK=" & kimlik)

Set baglan = Nothing: Set rs = Nothing:
MsgBox TextBox2 & " Kayıt silindi.", vbInformation + vbOKOnly, "Süleyman SAVAŞ"

listeye_al
temizle
End If
End Sub

Burada güncelleme modülünde If TextBox6.Value = True Then rs("talep_sonucu") = "Satınalmaya Gitti" End If textbox6 da veri varsa talep_sonucu alanına Satınalmaya Gitti yazıyor. Sorun yok, ancak yeni kayıt modülünde textbox6 da veri yoksa Satınalmaya Gitmedi yazması lazım, yazmıyor. [ICODE] If TextBox6.Value = False Then rs("talep_sonucu") = "Satınalmaya Gitmedi" End If
Yardımcı olacak arkadaşlara teşekkür ederim.
[/ICODE]
 
Konuyu güncellemek istiyorum.
Hala bir çözüm bulamadım.
Aynı prosedür ile güncelleme modülünde kayıt yapılırken yeni kayıt modülünde şartlı kayıt yapamadım.
 
Geri
Üst