General information
Category:
Databases,Tables, Views, Indexing and SQL syntax
Title:
Problem deleting records with view
You guys have helped me twice so far and I am very grateful. I have another one.
I have an order entry form that creates records in the orders table for order header info and records in the orditems table for the line items. When the user cancels an order, it should lop through the line items and delete them. It does not work correctly. neworditems is a view setup that is keyed by a field called ordnum and lineno. ordnum is the key to the orders table.
Here is the add item logic:
INSERT INTO neworditems(LINENO,ordnum,itemno,DESCRIP,destype,descode,desdescrip,location,qtyord,qtyshp,;
qtybo,unit,unitpr,taxable,charges,chgtax,vencost,salesacct,;
STYLE,COLOR,sizetype,SIZE,sizesort,subcontract,designonly);
VALUES(THISFORM.LINENO,;
neworders.ordnum,THIS.PARENT.combo1.VALUE,THISFORM.DESCRIP,THIS.PARENT.combo2.VALUE,;
THIS.PARENT.combo3.VALUE,THISFORM.desdescrip,THIS.PARENT.comboloc.VALUE,;
THIS.PARENT.spinner1.VALUE,THIS.PARENT.spinner1.VALUE,0.0,THISFORM.invunit,;
THIS.PARENT.spinner2.VALUE,.T.,0.00,0.00,THISFORM.vencost,THISFORM.salesacct,;
invbrowse.STYLE,invbrowse.COLOR,invbrowse.sizetype,invbrowse.SIZE,invbrowse.sizesort,.F.,.F.)
THISFORM.LINENO = THISFORM.LINENO + 1
Here is the delete line logic:
SELECT neworditems
SCAN FOR neworditems.ordnum = THISFORM.curordnum
MESSAGEBOX('ok')
DELETE
ENDSCAN
I added the messagebox to verify that it is fining the line item and I get the box. The problem is that the line item is never really deleted.
Any ideas?
Thank you!
Next
Reply
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only