As @Minty commented and posted, your dates are the issue.
- When running queries inside the MS Access GUI such as with Query Designer, you are governed to the Access SQL dialect.
- When connecting via ODBC driver to an external database, you are governed to the connecting database's SQL dialect, here being Quickbooks.
No two SQL dialects are ever the same but most attempt to conform to ANSI standards. Therefore, the same queries can fail between Query Designer and VBA.
MS Access
MS Access dates if sent literally, should be encapsulated with hashtags, #:
INSERT INTO Invoice (CustomerRefListID, ARAccountRefListID, TxnDate, RefNumber,
BillAddressAddr1, BillAddressAddr2, BillAddressCity, BillAddressState,
BillAddressPostalCode, BillAddressCountry, IsPending, TermsRefListID,
DueDate, ShipDate, ItemSalesTaxRefListID, [Memo], IsToBePrinted,
CustomerSalesTaxCodeRefListID)
VALUES ('800001F6-1482536280', '8000001E-1478562986', #9/23/2020#, '1', 'Brad Lamb',
'1921 Appleseed Lane', 'Bayshore', 'CA', '94326', 'USA', 0, '80000002-1478562832',
#10/31/2020#, #10/01/2020#, '8000295C-1541711590',
'Memo Test', 0, '80000001-1478562826')
Alternatively, use CDate() to convert string to date:
INSERT INTO Invoice (CustomerRefListID, ARAccountRefListID, TxnDate, RefNumber,
BillAddressAddr1, BillAddressAddr2, BillAddressCity, BillAddressState,
BillAddressPostalCode, BillAddressCountry, IsPending, TermsRefListID,
DueDate, ShipDate, ItemSalesTaxRefListID, [Memo], IsToBePrinted,
CustomerSalesTaxCodeRefListID)
VALUES ('800001F6-1482536280', '8000001E-1478562986', CDate('9/23/2020'), '1', 'Brad Lamb',
'1921 Appleseed Lane', 'Bayshore', 'CA', '94326', 'USA', 0, '80000002-1478562832',
CDate('10/31/2020'), CDate('10/01/2020'), '8000295C-1541711590',
'Memo Test', 0, '80000001-1478562826')
Quickbooks ODBC
In Quickbooks, you must adhere to its date requirement of {d 'YYYY-MM-DD'} or the functional form fncqbDate(). However, documentation on these methods is sparse to non-existent and can vary with ODBC driver versions.
sql = "INSERT INTO Invoice (CustomerRefListID, ARAccountRefListID, TxnDate, RefNumber, " _
& " BillAddressAddr1, BillAddressAddr2, BillAddressCity, " _
& " BillAddressState, BillAddressPostalCode, BillAddressCountry, " _
& " IsPending, TermsRefListID, DueDate, ShipDate, " _
& " ItemSalesTaxRefListID, [Memo], IsToBePrinted, " _
& " CustomerSalesTaxCodeRefListID) " _
& " VALUES ('800001F6-1482536280', '8000001E-1478562986', {d '2020-09-23'}, '1', " _
& " 'Brad Lamb', '1921 Appleseed Lane', 'Bayshore', 'CA', '94326', 'USA', 0, " _
& " '80000002-1478562832', {d '2020-10-31'}, {d '2020-10-01'}, " _
& " '8000295C-1541711590', 'Memo Test', 0, '80000001-1478562826')"
Parameterization
With that said, even if above does not work, this is yet another good reason for parameterization, a programming industry standard for any application layer like VBA to run SQL. Parameterization facilitates data type mapping between client and server without the need of quote or other symbolic closures. ADO does support parameters with CreateParameter method inside an ADO Command object (not ADO recordset).
' PREPARED STATEMENT WITH PLACEHOLDERS (NO LITERAL DATA)
sql = "INSERT INTO Invoice (CustomerRefListID, ARAccountRefListID, TxnDate, RefNumber, " _
& " BillAddressAddr1, BillAddressAddr2, BillAddressCity, " _
& " BillAddressState, BillAddressPostalCode, BillAddressCountry, " _
& " IsPending, TermsRefListID, DueDate, ShipDate, " _
& " ItemSalesTaxRefListID, [Memo], IsToBePrinted, " _
& " CustomerSalesTaxCodeRefListID) " _
& " VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?," _
& " ?, ?, ?, ?, ?, ?, ?, ?, ?)"
' OPEN CONNECTION
Set oConnection = CreateObject("ADODB.Connection")
oConnection.Open sConnectString
' INITIALIZE AND RUN COMMAND
Set oCmd = CreateObject("ADODB.Command") ' NEW ADO OBJECT
With oCmd
.ActiveConnection = oConnection
.CommandText = sql
.CommandType = adCmdText
' BIND PARAMETERS
.Parameters.Append .CreateParameter("pm1", adVarChar, adParamInput, ,"800001F6-1482536280")
.Parameters.Append .CreateParameter("pm2", adVarChar, adParamInput, ,"8000001E-1478562986")
.Parameters.Append .CreateParameter("pm3", adDate, adParamInput, , CDate("9/23/2020"),
.Parameters.Append .CreateParameter("pm4", adVarChar, adParamInput, ,"1")
.Parameters.Append .CreateParameter("pm5", adVarChar, adParamInput, ,"Brad Lamb")
.Parameters.Append .CreateParameter("pm6", adVarChar, adParamInput, ,"1921 Appleseed Lane")
.Parameters.Append .CreateParameter("pm7", adVarChar, adParamInput, ,"Bayshore")
.Parameters.Append .CreateParameter("pm8", adVarChar, adParamInput, ,"CA")
.Parameters.Append .CreateParameter("pm9", adVarChar, adParamInput, ,"94326")
.Parameters.Append .CreateParameter("pm10", adVarChar, adParamInput, ,"USA")
.Parameters.Append .CreateParameter("pm11", adInteger, adParamInput, , 0)
.Parameters.Append .CreateParameter("pm12", adVarChar, adParamInput, ,"80000002-1478562832")
.Parameters.Append .CreateParameter("pm13", adDate, adParamInput, , CDate("10/31/2020"))
.Parameters.Append .CreateParameter("pm14", adDate, adParamInput, , CDate("10/01/2020"))
.Parameters.Append .CreateParameter("pm15", adVarChar, adParamInput, ,"8000295C-1541711590")
.Parameters.Append .CreateParameter("pm16", adVarChar, adParamInput, ,"Memo Test")
.Parameters.Append .CreateParameter("pm17", adInteger, adParamInput, ,0)
.Parameters.Append .CreateParameter("pm18", adVarChar, adParamInput, ,"80000001-1478562826")
' RUN PARAMETERIZED QUERY
.Execute
End With
oConnection.Close
Set oCmd = Nothing: Set oConnection = Nothing
#9/23/2020#is not valid SQL.