Knowledgebase: Tutorials
[QODBC] Requires at least one child. Cannot delete the last line.
Posted by Jack - QODBC Support on 05 August 2014 11:43 AM

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 that there be at least one record in InvoiceLine? If so, will delete the Invoice delete the InvoiceLine record?
Or - how do I get around the problem?





You can delete all records of Child tables. If all the records of child table e.g. InvoiceLine are deleted, the header record will not be of any use. If all the rows of a transaction are to be deleted, that means you would like to discard/delete the transaction. For deleting the transaction/invoice, delete the header row, and all its child records like InvoiceLine, Invoice linked transaction will be deleted automatically.

I think 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, then you need to provide InvoiceLineTxnLineID in where 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'

If you want to delete all line items, then you need to delete records from the header table.

DELETE FROM Invoice WHERE TxnNumber = 3444

(1 vote(s))
Not helpful

Comments (0)
Post a new comment
Full Name:
CAPTCHA Verification 
Please complete the captcha below (we use this to prevent automated submissions).