-
[RESOLVED] Query Help
Hey there
to start of with my sql is pretty poor when attempting complicated queries
so i was wondering how to do the following
l_sqlStmt = "UPDATE stocktakeitem SET "
l_sqlStmt &= "qty = qty + " & p_sti.Qty & " "
l_sqlStmt &= "WHERE stiid = " & p_sti.StockTakeItemID
its the bold part im trying to work out i want to update the qty that exists by adding the old qty and new qty together.
im sure its a subquery thats involved here
-
Re: Query Help
If p_sti.Qty and p_sti.StockTakeItemID both return a number (in VB) , then it should be ok.
If it doesn't work, show us the full SQL statement (using: Debug.Print l_sqlStmt ), and tell us what the problem is.
-
Re: Query Help
That looks about fine at first glance at least. Try enclosing the addition in parantheses.
What is the problem though?
-
Re: Query Help
cant believe thats works.... but the reason it didnt for me was i left something obvious out of the where clause... cheers for the help