Problem Description:
I am getting the following error trying to delete a record from InvoiceLine: [QODBC] Requires at least one child. Cannot delete the last line (#10074) Does the invoice file require at least one record in InvoiceLine? If so, will delete the Invoice delete the InvoiceLine record? Or - how do I get around the problem?
Solution:
You can delete all records of Child tables. If all the forms of the child table, e.g., InvoiceLine, are deleted, the header record will not be of use. If all the transaction rows are to be deleted, you would like to discard/delete the transaction. For deleting the transaction/invoice, delete the header row, and all its child records, like InvoiceLine, and Invoice linked transactions, will be deleted automatically.
You have only one line item in an InvoiceLine table for that particular TxnId. QODBC / QuickBooks SDK cannot delete the last line item (invoice line having only 1 row left for the transaction/invoice), which is associated with the header a row of Invoice.
If you have multiple lines and would like to delete line items, you need to provide InvoiceLineTxnLineID in the clause. You cannot use TxnNumber or TxnID because it is the same for all line items. But InvoiceLineTxnLineID is unique for each line item.
Please refer to the sample query:
DELETE FROM InvoiceLine WHERE InvoiceLineTxnLineID='376D-1264409144'
You must delete records from the header table to delete all line items.
DELETE FROM Invoice WHERE TxnNumber = 3444
|