charles
|
Posted: 02/19/2004, 2:57 PM |
|
I am having problems with this custom insert code for updating product
inventory after a transaction has taken place on the the order_items table.
There is no error message but no updates takes place either.
here is my code for the after execute update event
Dim SQL
Dim Connection
Dim ErrorMessage
SQL = "update products "&_
"set unitsinstock=(products.unitsinstock-order_items.quantity)"&_
"from products,order_items"&_
"where products.product_id = order_items.product_id"
Set Connection = New clsDBConnection1
Connection.Open
Connection.Execute(SQL)
ErrorMessage = CCProcessError(Connection)
Connection.Close
Set Connection = Nothing
On Error Goto 0
|
|
|
DonB
|
Posted: 02/19/2004, 3:08 PM |
|
You at least need to do a couple things, I think: (1) put spaces after the
quote mark a the beginning of each line (like " FROM); (2) put spaces before
and after the "&" contatenation character. Maybe they are there in the code
and just not evident in your message?
I assume that if you execute the from/where portion with a SELECT that it
will return some rows. Have you verified that this is not updating due to
it being an "empty" set (of records)?
--
DonB
http://www.gotodon.com/ccbth
"charles" <ronicsyscom@ronicsystems.com> wrote in message
news:c13f14$n1u$1@news.codecharge.com...
> I am having problems with this custom insert code for updating product
> inventory after a transaction has taken place on the the order_items
table.
> There is no error message but no updates takes place either.
> here is my code for the after execute update event
> Dim SQL
> Dim Connection
> Dim ErrorMessage
>
> SQL = "update products "&_
> "set unitsinstock=(products.unitsinstock-order_items.quantity)"&_
> "from products,order_items"&_
> "where products.product_id = order_items.product_id"
> Set Connection = New clsDBConnection1
> Connection.Open
> Connection.Execute(SQL)
> ErrorMessage = CCProcessError(Connection)
> Connection.Close
> Set Connection = Nothing
> On Error Goto 0
>
>
>
|
|
|
|