I'm having a problem getting a field update to work. Can anyone spot my error?
I have an Orders table and an OrderItems table. Orders has a 'Shipdate' field for a completed order, and OrderItems has a 'shipped' field for individual items that have been shipped. One routine is called when single-item orders are shipped and is intended to put the system date in both the Orders.shipdate and OrderItems.shipped fields. For some reason, it never fills the orderitems.shipped field.
Code follows below. c_Orders is a cursor containing the order_ids of all filled orders. I think I'm scanning the c_orders cursor, finding the matching item in the Orders table, updating it, then getting the matching order_id in the orderitems table and updating it. I thought that REPLACE FOR order_id = lcOrdNum would update at the same time all the records in orderitems that had that order_id. Am I wrong?
Suggestions gratefully accepted....
Neil Preston
SELECT Orders
lcOrdersOldOrder = ORDER()
SET ORDER TO order_id
SELECT orderitems
lcItemsOldOrder = ORDER()
SET ORDER TO order_id
SELECT c_Orders
SCAN
lcOrdNum = order_id
SELECT Orders
SEEK lcOrdNum
IF FOUND()
REPLACE shipdate WITH DATE()
ELSE
WAIT WINDOW AT 20,20 ' Order not found '
ENDIF
SELECT orderitems
REPLACE shipped WITH DATE() FOR order_id = lcOrdNum
ENDSCAN