Results 1 to 3 of 3
  1. #1
    Lounger
    Join Date
    Jan 2006
    Posts
    43
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Inserting a constant (Access 2000)

    Could you help me inserting a constant into an sql ? I tried but without success.I am quoting below the constant,the query and the sql i wanted to modify.
    Public Const strIn = " In (118,119,120,121,122,123,124,960,992,1008,402)"
    This is the working query :
    SELECT orders.orderid, orders.orderdate, customers.CompanyName, orders.customerid
    FROM orders INNER JOIN customers ON orders.customerid = customers.Customerid
    WHERE (((orders.customerid) In (118,119)))
    ORDER BY orders.orderdate DESC;
    This is the sql where I want to insert the constant strIn, but I get red letters :
    strBas = "SELECT orders.orderid, orders.orderdate, customers.CompanyName, orders.customerid" & _
    " FROM orders INNER JOIN customers ON orders.customerid = customers.Customerid " & _
    " WHERE (((orders.customerid) " & strIn))" & _
    " ORDER BY orders.orderdate DESC"

  2. #2
    3 Star Lounger
    Join Date
    Dec 2001
    Location
    Schenectady, New York, USA
    Posts
    273
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Inserting a constant (Access 2000)

    strBas = "SELECT orders.orderid, orders.orderdate, customers.CompanyName, orders.customerid" & _
    " FROM orders INNER JOIN customers ON orders.customerid = customers.Customerid " & _
    " WHERE (((orders.customerid) " & strIn & "))" & _
    " ORDER BY orders.orderdate DESC"
    Don
    <img src=/S/flags/USA.gif border=0 alt=USA width=30 height=18> <img src=/S/flags/NewYork.gif border=0 alt=NewYork width=30 height=18> "Life on Earth is expensive, but at least it includes a free trip around the Sun."

  3. #3
    Lounger
    Join Date
    Jan 2006
    Posts
    43
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Inserting a constant (Access 2000)

    Thanks DJLansing!You have corrected my slq perfectly. I was surprised by the quick repliy.It came almost instantly. I have no errors any more.

Posting Permissions

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