Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

update command

Status
Not open for further replies.

canett

Technical User
Jan 22, 2006
18
BG
I want write an update command in an sql form and not with the help of a query.

My present working code now is :
Dim strSQL As String
strSQL = "UPDATE qryOrderDetails SET Branch0 = Branch0 - cartons "
CurrentDb.Execute strSQL, dbFailOnError

The query qryOrderDetails in an sql form is :


strSQL = " SELECT [order details].OrderID, [order details].ProductID, [order details].cartons, [order details].Quantity, [order details].liters, products.size,
products.branch0, products.items0, orders.customerid, Customers.Customerid " & _
" FROM (([order details] INNER JOIN products ON [order details].ProductID = products.Productid) INNER JOIN orders ON [order details].OrderID = orders.orderid) INNER JOIN

Customers ON orders.customerid = Customers.Customerid " & _
" WHERE ((([order details].OrderID)=(SELECT Max([orderid]) FROM orders)))" & _
" ORDER BY [order details].OrderID"


How can i update the branch0 in the above sql?
 
you can't update a query...

you need to update the table that branch0 resides in...

you can use the results of the query as a select in your update though, but you still have to base the update command on the table...

--------------------
Procrastinate Now!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top