Kod:
Private Sub ComboBox1_Change()
On Error Resume Next
If ComboBox1.ListIndex > -1 Then
secim = ComboBox1.List(ComboBox1.ListIndex, 0)
no.Text = ComboBox1.List(ComboBox1.ListIndex, 1)
t1.Text = secim
For i = 2 To 192
'Controls("t" & i).Text = Empty
Me.Controls("t" & i).Text = ""
Next i
Set RS = CreateObject("adodb.recordset")
RS.Open "select * from ana where v1='" & ana & "'", baglan, 1, 1
If RS.RecordCount > 0 Then
For i = 2 To RS.Fields.Count - 1
Controls("t" & i).Text = RS.Fields(i).Value
Next i
Set RS = CreateObject("adodb.recordset") 'kesim tablosunda 240ad sütun var
RS.Open "select * from kesim where v1='" & secim & "'", baglan, 1, 1
If RS.RecordCount > 0 Then
For i = 240 To RS.Fields.Count - 80
Controls("t" & i).Text = RS.Fields(i).Value
Next i
Set RS = CreateObject("adodb.recordset") 'dikim tablosunda 170 sütun var
RS.Open "select * from dikim where v1='" & secim & "'", baglan, 1, 1
If RS.RecordCount > 0 Then
For i = 170 To RS.Fields.Count - 10
Controls("t" & i).Text = RS.Fields(i).Value
Next i
End If
End If
RS.Close
s = "select sum(kesim.v160) as kesimv160, sum(kesim.v161) as kesimv161,sum(kesim.v162) as kesimv162,sum(kesim.v163) as kesimv163,sum(kesim.v164) as kesimv164,sum(kesim.v165) as kesimv165, sum(kesim.v166) as kesimv166,sum(kesim.v167) as kesimv167,sum(kesim.v168) as kesimv168,sum(kesim.v169) as kesimv169,sum(kesim.v170) as kesimv170,"
s = s & "sum(dikim.v160) as dikimv160,sum(dikim.v161) as dikimv161,sum(dikim.v162) as dikimv162,sum(dikim.v163) as dikimv163,sum(dikim.v164) as dikimv164,sum(dikim.v165) as dikimv165,sum(dikim.v166) as dikimv166,sum(dikim.v167) as dikimv167,sum(dikim.v168) as dikimv168,sum(dikim.v169) as dikimv169,sum(dikim.v170) as dikimv170,"
s = s & "sum(dikimc.v160) as dikimcv160,sum(dikimc.v161) as dikimcv161,sum(dikimc.v162) as dikimcv162,sum(dikimc.v163) as dikimcv163,sum(dikimc.v164) as dikimcv164,sum(dikimc.v165) as dikimcv165,sum(dikimc.v166) as dikimcv166,sum(dikimc.v167) as dikimcv167,sum(dikimc.v168) as dikimcv168,sum(dikimc.v169) as dikimcv169,sum(dikimc.v170) as dikimcv170,"
s = s & " sum(paketleme.v160) as paketlemv160,sum(paketleme.v161) as paketlemev161,sum(paketleme.v162) as paketlemev162,sum(paketleme.v163) as paketlemev163,sum(paketleme.v164) as paketlemev164,sum(paketleme.v165) as paketlemev165,sum(paketleme.v166) as paketlemev166,sum(paketleme.v167) as paketlemev167,sum(paketleme.v168) as paketlemev168,sum(paketleme.v169) as paketlemev169,sum(paketleme.v170) as paketlemev170,"
s = s & "sum(nakıs.v160) as nakısv160,sum(nakıs.v161) as nakısv161,sum(nakıs.v162) as nakısv162,sum(nakıs.v163) as nakısv163,sum(nakıs.v164) as nakısv164,sum(nakıs.v165) as nakısv165,sum(nakıs.v166) as nakısv166,sum(nakıs.v167) as nakısv167,sum(nakıs.v168) as nakısv168,sum(nakıs.v169) as nakısv169,sum(nakıs.v170) as nakısv170,"
s = s & "sum(nakısgelen.v160) as nakısgelenv160,sum(nakısgelen.v161) as nakısgelenv161,sum(nakısgelen.v162) as nakısgelenv162,sum(nakısgelen.v163) as nakısgelenv163,sum(nakısgelen.v164) as nakısgelenv164,sum(nakısgelen.v165) as nakısgelenv165,sum(nakısgelen.v166) as nakısgelenv166,sum(nakıs.v167) as nakısgelenv167,sum(nakısgelen.v168) as nakısgelenv168,sum(nakısgelen.v169) as nakısgelenv169,sum(nakısgelen.v170) as nakısgelenv170,"
s = s & "sum(baskı.v160) as baskıv160,sum(baskı.v161) as baskıv161,sum(baskı.v162) as baskıv162,sum(baskı.v163) as baskıv163,sum(baskı.v164) as baskıv164,sum(baskı.v165) as baskıv165,sum(baskı.v166) as baskıv166,sum(baskı.v167) as baskıv167,sum(baskı.v168) as baskıv168,sum(baskı.v169) as baskıv169,sum(baskı.v170) as baskıv170,"
s = s & "sum(baskıc.v160) as baskıcv160,sum(baskıc.v161) as baskıcv161,sum(baskıc.v162) as baskıcv162,sum(baskıc.v163) as baskıcv163,sum(baskıc.v164) as baskıcv164,sum(baskıc.v165) as baskıcv165,sum(baskıc.v166) as baskıcv166,sum(baskıc.v167) as baskıcv167,sum(baskıc.v168) as baskıcv168,sum(baskıc.v169) as baskıcv169,sum(baskıc.v170) as baskıcv170,"
s = s & "sum(yıkama.v160) as yıkamav160,sum(yıkama.v161) as yıkamav161,sum(yıkama.v162) as yıkamav162,sum(yıkama.v163) as yıkamav163,sum(yıkama.v164) as yıkamav164,sum(yıkama.v165) as yıkamav165,sum(yıkama.v166) as yıkamav166,sum(yıkama.v167) as yıkamav167,sum(yıkama.v168) as yıkamav168,sum(yıkama.v169) as yıkamav169,sum(yıkama.v170) as yıkamav170,"
s = s & "sum(yıkamagelen.v160) as yıkamagelenv160,sum(yıkamagelen.v161) as yıkamagelenv161,sum(yıkamagelen.v162) as yıkamagelenv162,sum(yıkamagelen.v163) as yıkamagelenv163,sum(yıkamagelen.v164) as yıkamagelenv164,sum(yıkamagelen.v165) as yıkamagelenv165,sum(yıkamagelen.v166) as yıkamagelenv166,sum(yıkamagelen.v167) as yıkamagelenv167,sum(yıkamagelen.v168) as yıkamagelenv168,sum(yıkamagelen.v169) as yıkamagelenv169,sum(yıkamagelen.v170) as yıkamagelenv170,"
s = s & " from (kesim inner join dikim on kesim.v1 = dikim.v1) inner join paketleme on dikim.v1 = paketleme.v1"
s = s & " group by kesim.v1 having (((kesim.v1)='" & secim & "'))"
Call baglanti
RS.Open s, baglan, 1, 1
If RS.RecordCount > 0 Then
For i = 0 To RS.Fields.Count - 1
Controls("t" & i + 60).Value = RS.Fields(i).Value
Next i
End If
End If
End If
End Sub