1

Why do I keep receiving the issue Run-time "3155"

ODBC -- insert on a linked table 'New_Invoice' failed. At least one line record is required.

Is there an issue with my InvoiceLine Query?

The following is my code:

I have a button that executes these two queries:

First the QB_InvoiceLine Query:

INSERT INTO InvoiceLine ( InvoiceLineItemRefListID, InvoiceLineDesc, InvoiceLineQuantity, ClassRefListID, FQSaveToCache )
SELECT t.QB_RMA_Parts.ListID, t.Description, t.Quantity, t.Class_ID, 1
FROM ForQB AS t
WHERE (((t.RMA)=[Forms]![SendToQuickBooks]![enterRMA]));

Than the QB_Invoice Query:

INSERT INTO New_Invoice ( CustomerRefListID, ARAccountRefListID, TxnDate, IsPending, DueDate, PONumber, IsToBePrinted )
SELECT t.Customer.ListID, '8000001E-1478562986', Date(), 0, Date() + 30, 'None', 0
FROM ForQB AS t

InvoiceLine and New_Invoice are both linked tables to QuickBooks.

Perhaps it is my syntax?

I know it is not an issue with the linked tables as I've tried using the following, with no issues:

INSERT INTO InvoiceLine (InvoiceLineItemRefListID, InvoiceLineDesc, InvoiceLineRate, InvoiceLineAmount, InvoiceLineSalesTaxCodeRefListID, FQSaveToCache) VALUES ('800011C0-1483210384', 'Building permit 1', 1.00000, 1.00, '80000001-1478562826', 1)


INSERT INTO Invoice (CustomerRefListID, ARAccountRefListID, TxnDate, RefNumber, BillAddressAddr1, BillAddressAddr2, BillAddressCity, BillAddressState, BillAddressPostalCode, BillAddressCountry, IsPending, TermsRefListID, DueDate, ShipDate, ItemSalesTaxRefListID, Memo, IsToBePrinted, CustomerSalesTaxCodeRefListID) VALUES ('800001F4-1482536279', '8000001E-1478562986', #9/23/2020#, '1', 'Brad Lamb', '1921 Appleseed Lane', 'Bayshore', 'CA', '94326', 'USA', 0, '80000020-1526673448', #10/31/2020#, #10/01/2020#, '800028FF-1539628499', 'Memo Test', 0, '80000003-1482379268')

Any ideas what the problem could be?

  • Error Msg suggest that no records are returned by the Select-Statements. Check if they return at least one. And the second table is called `Invoice`on your test, but error is in `New_Invoice` – ComputerVersteher Jan 26 '19 at 17:27
  • Everything is selected and copied correctly, but the error message still appears. The “Invoice” table name is my mistake. It’s supposed to be “New_Invoice” –  Jan 26 '19 at 17:40
  • Edit the typo! The query is excuted (all data inserted), but throws error? What happens using a recordset for select and one for insert? – ComputerVersteher Jan 26 '19 at 17:54
  • And your test insert on`New-Invoice`contains more fields than the failing query. Maybe some are not optional. Test with the skipped fields. – ComputerVersteher Jan 26 '19 at 18:04

0 Answers0