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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

SQL update not working with Access 97

Status
Not open for further replies.

shef015

Programmer
May 22, 2001
67
US
my update statement refuses to work for some reason. I have no clue why it doesn't work. I am connected to an Access 97 database. I delete the records in OrdersDetail(a child table to Orders) before running the update. here is my code, any help would be great


order = "Update ORDERS SET Payment = '" & oPay & "'" & _
" AND TotalAmount = " & oTotal & " Where OrderID = " & oId & ""
MsgBox (order)
Set rs_updateOrder = conn.Execute(order)
 
The AND does not belong. The proper T-SQL syntax would be:

UPDATE ORDERS
SET Payment = <something>, TotalAmount=<something>
WHERE OrderID = <orderID>

Your statement revised:

Order = &quot;UPDATE ORDERS &quot; & _
&quot; SET Payment = '&quot; & oPay & &quot;', &quot; & _
&quot; TotalAmount = &quot; & oTotal & &quot; &quot; & _
&quot;WHERE OrderID = &quot; & oId & &quot;&quot;



Mark
 
Hi

The problem is that rs_updateOrder expects a recordset from conn.Execute statement .
Just do
conn.Execute order

Balajee
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top