Arkadaşlar merhaba,
ListBox üzerinde bilgileri TextBox lara almak için aşağıdaki kodu kullanıyorum.Fakat hata veriyor.
Acaba nerde yanlış yapıyorum?
Private Sub ListBox1_Click()
Dim ith, tdr, mlz, urn, srn, rnk As String
Dim r As Integer
r = ListBox1.ListIndex
ith = ListBox1.List(r, 0) ' ithalat_no
tdr = ListBox1.List(r, 1) ' tedarikci
mlz = ListBox1.List(r, 2) ' malzeme_cinsi
urn = ListBox1.List(r, 3) ' urun_adi
srn = ListBox1.List(r, 4) ' sira_no
rnk = ListBox1.List(r, 4) ' renk
Set RS = CreateObject("ADODB.recordset")
strSQL = "SELECT * FROM [MyTable]Where (ithalat_no='" & ith & "' and tedarikci='" & tdr & "' and malzeme_cinsi='" & mlz & "' and urun_adi='" & urn & "'and sira_no='" & srn & "'and renk='" & rnk & "')"
RS.Open strSQL, adoCN, 1, 3
TextBox1 = RS("ithalat_no")
TextBox2 = RS("tedarikci")
TextBox3 = RS("malzeme_cinsi")
TextBox9 = RS("urun_adi")
TextBox14 = RS("sira_no")
TextBox16 = RS("renk")
CommandButton5.Enabled = True
CommandButton3.Enabled = True
Set RS = Nothing
End Sub
ListBox üzerinde bilgileri TextBox lara almak için aşağıdaki kodu kullanıyorum.Fakat hata veriyor.
Acaba nerde yanlış yapıyorum?
Private Sub ListBox1_Click()
Dim ith, tdr, mlz, urn, srn, rnk As String
Dim r As Integer
r = ListBox1.ListIndex
ith = ListBox1.List(r, 0) ' ithalat_no
tdr = ListBox1.List(r, 1) ' tedarikci
mlz = ListBox1.List(r, 2) ' malzeme_cinsi
urn = ListBox1.List(r, 3) ' urun_adi
srn = ListBox1.List(r, 4) ' sira_no
rnk = ListBox1.List(r, 4) ' renk
Set RS = CreateObject("ADODB.recordset")
strSQL = "SELECT * FROM [MyTable]Where (ithalat_no='" & ith & "' and tedarikci='" & tdr & "' and malzeme_cinsi='" & mlz & "' and urun_adi='" & urn & "'and sira_no='" & srn & "'and renk='" & rnk & "')"
RS.Open strSQL, adoCN, 1, 3
TextBox1 = RS("ithalat_no")
TextBox2 = RS("tedarikci")
TextBox3 = RS("malzeme_cinsi")
TextBox9 = RS("urun_adi")
TextBox14 = RS("sira_no")
TextBox16 = RS("renk")
CommandButton5.Enabled = True
CommandButton3.Enabled = True
Set RS = Nothing
End Sub