Results 1 to 3 of 3
  1. #1
    4 Star Lounger
    Join Date
    Feb 2002
    Posts
    537
    Thanks
    0
    Thanked 0 Times in 0 Posts

    commas (Access 2000)

    I am again having problems with these damned commas, they seem never to conform to my knowledge.I tried to convert the otherwise good and working update query into an sql but i got red colours showing that Access does not accept my commas.I tried with single commas ' or with double commas """" but obviously i jumbled the commas up with no result.Would you help me convert the update query below into an sql ?

    UPDATE products SET products.items4 = DLookUp("Diff","qryNetDiff","ProductID=" & [ProductID])
    WHERE (((products.Productid) In (SELECT ProductID FROM qryNetDiff)));

    My following two attempts failed:

    ',StrSQL = "UPDATE products SET products.items4 "DLookUp(""Diff"",""qryNetDiff"", ""ProductID="" & [ProductID])& "WHERE products.Productid In (SELECT ProductID FROM qryNetDiff)"

    strSQL = "UPDATE products SET products.items4 = DLookUp('Diff','qryNetDiff','ProductID='" & [ProductID]" & _
    "WHERE products.Productid In (SELECT ProductID FROM qryNetDiff)"

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: commas (Access 2000)

    Now, now, it is not very polite to use d**ed.

    You can use either of these:
    <code>
    strSQL = "UPDATE products SET products.items4 = " & _
    "DLookUp(""Diff"",""qryNetDiff"",""ProductID=" " & [ProductID]) " & _
    "WHERE products.Productid In (SELECT ProductID FROM qryNetDiff)"
    </code>
    or
    <code>
    strSQL = "UPDATE products SET products.items4 = " & _
    "DLookUp('Diff','qryNetDiff','ProductID=' & [ProductID]) " & _
    "WHERE products.Productid In (SELECT ProductID FROM qryNetDiff)"
    </code>
    But why do you want to do it this way? You can execut the stored query using code, instead of reconstructing the entire SQL.

    BTW, they are called quotes, not commas. This is a comma: ,

  3. #3
    4 Star Lounger
    Join Date
    Feb 2002
    Posts
    537
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: commas (Access 2000)

    Thank you for that ,it is perfect now. Once again Merry Christmas and my best wishes to you

    Freelance

Posting Permissions

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