|
[QODBC-Desktop] DELETE Statement Returns Success But Customer/Record Still Exists in QuickBooks
Posted by William - QODBC Support on 12 October 2026 09:16 AM
|
|||||||||
[QODBC-Desktop] DELETE Statement Returns Success But Customer/Record Still Exists in QuickBooksProblem Description:A DELETE statement executed via QODBC from an application (MS Excel VBA, MS Access, etc.) reports successful execution, but the record is still visible in QuickBooks. This occurs when attempting to delete a customer, vendor, or other list item that has been referenced by a transaction. Affected products: QODBC Desktop, QuickBooks Desktop Symptoms:
Cause:QuickBooks does not allow deletion of any list item (customer, vendor, item, etc.) that has been used in a transaction. When you try to delete such a record through QODBC, the operation silently fails or reports success without actually removing the record from QuickBooks' database. The SQL DELETE statement succeeds at the ODBC layer (the query is accepted), but QuickBooks itself refuses to remove the record due to its internal transactional integrity rules. Warning
QuickBooks Desktop does not permanently delete list items that have transaction history. Instead, it sets an Inactive flag on the record. The record remains in the data file but is hidden from normal use. Environment:
Solution:Step 1: Check if a Record Can Be DeletedBefore attempting to delete, check whether the record has been used in any transactions by querying with the UNOPTIMIZED keyword: SELECT ListID, FullName, IsActive FROM Customer UNOPTIMIZED WHERE FullName = 'Customer Name' If Step 2: Mark as Inactive Instead of DeletingTo "remove" a customer from normal use while preserving transaction history: UPDATE Customer SET IsActive = False WHERE FullName = 'Customer Name' This will hide the customer from all normal QuickBooks operations while preserving their complete transaction history. Step 3: View Inactive RecordsTo list all inactive customers: SELECT * FROM Customer UNOPTIMIZED WHERE IsActive = False Step 4: View Recently Deleted Records (Last 90 Days)QuickBooks retains deleted records for up to 90 days. To view them: SELECT * FROM ListDeleted UNOPTIMIZED The ListDeletedQuery (per the Intuit QBDesktop SDK) returns all list elements deleted within the last 90 days, grouped by object type. SQL Examples:UPDATE Vendor SET IsActive = False WHERE FullName = 'Vendor Name' SELECT * FROM Item UNOPTIMIZED WHERE IsActive = False Example Scenarios:Before the fix: A customer was inserted via QODBC from MS Excel VBA. The user then attempted to delete it using a DELETE statement, which reported success. However, when checking QuickBooks, the record still existed because it had been referenced in a transaction. After the fix: The INSERT and associated transactions were properly handled. The customer was set to Inactive instead of deleted, preserving their complete history while removing them from active use. Additional Notes:
Related Articles:Understanding QODBC UNOPTIMIZED Queries How to Insert Records via QODBC Keywords:QODBC DELETE UNOPTIMIZED Customer Inactive ListDeletedQuery QuickBooks SDK MS Excel VBA ODBC Transaction History
| |||||||||
|
|
|||||||||


