Results 1 to 2 of 2
  1. #1
    3 Star Lounger
    Join Date
    Jan 2001
    Posts
    254
    Thanks
    0
    Thanked 0 Times in 0 Posts

    a string within select clause? (Access 2000)

    Is it possible to build a string within a Select clause?

    I have a valid SQL function serving as a record source. I want to make the Select clause more flexible and nest a second SQL called StrNest within the Select clause.
    My valid sql clause is the following:

    strLondon = " SELECT products.Productid, products.code, products.grade, products.size, products.pack, products.branch4, products.items4 " & _
    " FROM products ORDER BY products.code;"
    Now i want to take out a part of the clause and make it a separate sql as follows:

    Dim strLondon As String
    Dim strNest As String
    strNest = "products.branch4, products.items4"
    strLondon= " SELECT products.Productid, products.code, products.grade, products.size, products.pack, & strNest & " & _
    " FROM products ORDER BY products.code;"
    As could be seen, i have replaced the fields products.branch4,product.items4 with the string StrNest, and then i used this string
    wihing the clause :
    & strNest &
    However i receive the message syntax error, missing operator in strNest.

    Can somebody help me ?

  2. #2
    2 Star Lounger
    Join Date
    Dec 2000
    Posts
    120
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: a string within select clause? (Access 2000)

    You just have the quotes a little off:

    strLondon= " SELECT products.Productid, products.code, products.grade, products.size, products.pack, " & strNest & " FROM products ORDER BY products.code;"

Posting Permissions

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