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

    Exclamation Unanswered: Urgent Need Help In Complex Sql Statment

    Hi All
    I have DB Called CarSales
    I have two Makes
    Audi
    BMW

    I want To KNow The Qty For Audi And BMW Between 2004 And 2006
    M0 = "Make"
    S0 = "Audi"
    S1 = "BMW"
    fd1 = Text7 ' From Date
    td1 = Text8 ' To Date
    fy1 = year(fd) ' From Year as Integer
    ty1 = year(td) ' To Year as Integer


    I do this Code and it gives Records No = 0 when i Put The Between Years

    rs.Open " SELECT " & M0 & ", Sum(Qty) As Qty, CYear From CarSales Where ( CarSales." & M0 & "= '" & S0 & "' Or CarSales." & M0 & "= '" & S1 & "') Or (CarSales.Cyear between " & fy1 And " & ty1 ) GROUP BY CarSales." & M0 & ", CarSales.CYear ;" NOT WORK COZ OF CYEAR BETWEEN

    rs.Open " SELECT " & M0 & ", Sum(Qty) As Qty, CYear From CarSales Where ( CarSales." & M0 & "= '" & S0 & "' Or CarSales." & M0 & "= '" & S1 & "') GROUP BY CarSales." & M0 & ", CarSales.CYear ;" Worked Correct

    Why Plz I need YOUR HEL Urgent

    Sami Al Damiri
    Sami Al Damiri ...

  2. #2
    Join Date
    Feb 2006
    Posts
    113
    Sam,

    A guess really. What about if you change "OR" to "AND" ?

    If the BETWEEN syntax is wrong, you might have better success on the ACCESS section, or reading HELP in MS Access.

    Fazza
    Last edited by Fazza; 03-01-06 at 21:19.

Posting Permissions

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