I'm working on code to import invoices created in a custom application into QuickBooks using the QODBC driver. I have things nearly working, but I'm running into a problem with the INSERT that adds the actual invoice record. My overall code is based on the model laid out at http://support.flexquarters.com/esupport/index.php?_m=knowledgebase&_a=viewarticle&kbarticleid=10726&nav=0,58,64.
In this particular case, the INSERTs into the InvoiceLine table are working, but the INSERT into Invoice fails with this error:
[QODBC] Error: 3140 - There is an invalid reference to QuickBooks Item "" in the Invoice line.
Here's the INSERT command that I'm sending in this case:
INSERT INTO Invoice (CustomerRefListID, ARAccountRefFullName, TxnDate, RefNumber, TermsRefFullName, TemplateRefFullName, SalesRepRefListID, ClassRefListID)
VALUES ('80000855-1326914216', 'Receivables', {d '2012-01-17'}, '12-1005', '30 days', 'Customized Invoice', '30000-1034349330', '8F70000-912629594')
The values for CustomerRefListID, SalesRepListID, and ClassRefListID are all determined by doing look-ups into the respective tables. I've also confirmed that '30 days' occurs in the Terms table.
An earlier version of the code that generates this command was working a few days ago with different data. It used SalesRepRefFullName and ClassRefFullName. I modified it because of the failure of this case, thinking that perhaps the strings I had available didn't always exactly match the fullnames.
Any suggestions welcomed.
Tamar