koq panjang bener perintah nya
kalau cuma mau sum kan kurang lebih cukup seperti ini ( saya pakai adodb 
yah, gak biasa pakai adodc :) 
Asumsu Connection nya adalah CN
dim rs as new adodb.recordset
dim a as string
a = "select sum(keluar)as jumlahe from tbkartustock WHERE nip='" & 
txtSales.Text & "'" & _
       " and kode='" & txtKDBRG.Text & "'" & _
       " and tanggal between #" & Format(DTPicker1.Value, "MM/dd/yyyy") & 
"# and #" & Format(DTPicker2.Value, "MM/dd/yyyy") & "# "
rs.open a,cn
if not cn.eof then
        if not isnull(rs!jumlahe) then
            txtKeluarRokok.Text = rs!jumlahe
        else
              txtKeluarRokok.Text = 0
        end if
end if


Thanks
It is bike tobe important,but it is more important tobe bike
Memang bike menjadi orang penting, tapi lebih penting lagi untuk menjadi 
orang bike,
Ronald Irawan
Kalbe Nutritionals
Jakarta

-------------------------- 
Powered by Xero BlueBerry®



"sherinalavenda" <sherinalave...@yahoo.com> 
Sent by: Programmer-VB@yahoogroups.com
05/07/2009 02:19
Please respond to
Programmer-VB@yahoogroups.com


To
Programmer-VB@yahoogroups.com
cc

Subject
[Programmer-VB] help.. perintah sql sum








Dim jumlahe As Double
Do While Not rstbarang.EOF

txtKDBRG.Text = rstbarang.kode
txtNMbrg.Text = rstbarang.namabarang

Do While Not rstsales.EOF
txtSales.Text = rstsales.nip
a = "select sum(keluar)as jumlahe from tbkartustock WHERE nip='" & 
txtSales.Text & " '"
a = a & "and kode='" & txtKDBRG.Text & " ' "
a = a & "and tanggal between #" & Format(DTPicker1.Value, "MM/dd/yyyy") & 
"# and #" & Format(DTPicker2.Value, "MM/dd/yyyy") & "# "
txtKeluarRokok.Text = jumlahe
Adodc11.RecordSource = a
Adodc11.Refresh
rstsales.MoveNext
Loop

rstbarang.MoveNext
Loop

sy bermaksud melakukan filter tsb diatas tapi gagal. 
apakah meletakkan hasil sum kedalam textbox dapat dilakukan?
mohon petunjuknya. trims


Kirim email ke