Ado ile iki tarih arası sorgu

Katılım
30 Ekim 2010
Mesajlar
108
Excel Vers. ve Dili
2007 Türkçe
Kod:
tt = AYARLAR.TextBox12.Value

Set con = CreateObject("adodb.connection")
    con.Open "Provider=Microsoft.ACE.OLEDB.12.0;" & "Data Source=" & tt & ";" & "Extended Properties=""Excel 12.0;hdr=yes;imex=1"""
   
    
    bas = CLng(CDate(TESLIM_A.Value)): bit = CLng(CDate(TESLIM_B.Value)): KODE = CStr(durum_sorgu.Value)
    sorgu = "select * from [SIPARIS$] where clng(cdate(TESLIM_TARIHI)) >=" & bas & ""
    sorgu = sorgu & " and clng(cdate(TESLIM_TARIHI)) <=" & bit & " and [DURUM]='" & KODE & "'"
    Set rs = con.Execute(sorgu)
    
 ListBox1.Clear

        While rs.EOF = False
           
            
            Liste = ListBox1.ListCount
            ListBox1.AddItem
            
            ListBox1.List(Liste, 0) = rs.Fields(12)
            ListBox1.List(Liste, 1) = rs.Fields(16)
            ListBox1.List(Liste, 2) = rs.Fields(13)
            ListBox1.List(Liste, 3) = rs.Fields(14)
            ListBox1.List(Liste, 4) = rs.Fields(15)
            ListBox1.List(Liste, 5) = rs.Fields(21)
            
            ListBox1.ColumnWidths = "60;220;90;90;90;120"
            rs.MoveNext
        Wend
Yukarıdaki kod ile kapalı dosyadan iki tarih arasını bir kritere göre sorgu yaptırıyorum. Sorun şu ki; tekrar eden kayıtlar var ve bunların görünmesini istemiyorum. Sorgu kısmına gruplamayı nasıl ekleyebilirim
 
Katılım
30 Ekim 2010
Mesajlar
108
Excel Vers. ve Dili
2007 Türkçe
Ado ile iki tarih arasında bir kritere göre göre tekrarsız veri alıp listbox'a aktarabileceğim örnek bir dosya var mıdır?
 
Üst