Results 1 to 3 of 3
  1. #1
    Join Date
    Jun 2005
    Posts
    61

    Unanswered: Urgent Help in Sql Statment

    i wrote this code in vb6
    fd1 = 1/1/2004
    td1= 31/12/2006

    Dim i As Integer
    Dim k As Integer
    k = List2.ListCount
    For i = 0 To k
    rs.Open "Select " & Y1 & ", Sum(Qty) As Qty From CarSales" & _
    " WHERE " & M0 & " In ('" & List2.List(i) & "')" & _
    "And CDate Between #" & fd1 & "# and #" & td1 & "# Group By CarSales." & Y1 & ""
    '
    Next i
    Set DataGrid1.DataSource = rs

    i wrote this code to get all the qty in different year

    and it just give the first record between the 1/1/2004 and 31/12/2006

    why

    even that its goes over all the item in the list2

    it just give me the first record even it sees the other data

    any help

    Regards
    Sami Al Damiri ...

  2. #2
    Join Date
    Sep 2003
    Location
    MI
    Posts
    3,713
    I see where you're running a query thru a recordset in the for loop... BUT, where is your assignment of the result? I see 1 assignment after the loop so you only see results for the last query executed ...
    Back to Access ... ADO is not the way to go for speed ...

  3. #3
    Join Date
    Jun 2005
    Posts
    61
    Thank For replying
    But i didnt know how to slove this problem

    i hope u can Help me
    Sami Al Damiri ...

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •