commas

  • Thread starter peljo via AccessMonster.com
  • Start date
P

peljo via AccessMonster.com

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.items5 = DLookUp("Diff","qryNetDiff",
"ProductID=" & [ProductID])
WHERE (((products.Productid) In (SELECT ProductID FROM qryNetDiff)));
 
J

Jeanette Cunningham

Hi again Peljo,

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


Jeanette Cunningham
 
S

Steve Sanford

I think that the DLOOKUP() function should be outside of the quotes. Add
another line after "strSQL=..." to check (and delete or comment it after
testing):

Msgbox strSQL



I would have used:

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

Msgbox strSQL


Also, if "products.items5" is a string, don't forget to delimit the
DLOOKUP() function with single quotes.

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

Msgbox strSQL


Happy Holidays :D


HTH
--
Steve S
--------------------------------
"Veni, Vidi, Velcro"
(I came; I saw; I stuck around.)


Jeanette Cunningham said:
Hi again Peljo,

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


Jeanette Cunningham


peljo via AccessMonster.com said:
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.items5 = DLookUp("Diff","qryNetDiff",
"ProductID=" & [ProductID])
WHERE (((products.Productid) In (SELECT ProductID FROM qryNetDiff)));
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top