|
[QODBC-ALL] Access VBA Recordset.RecordCount Returns "-1" After QuickBooks Enterprise 25 Upgrade
Posted by William - QODBC Support on 07 October 2026 07:44 AM
|
|||||||||
[QODBC-ALL] Access VBA Recordset.RecordCount Returns "-1" After QuickBooks Enterprise 25 UpgradeProblem Description:After upgrading to QuickBooks Enterprise 25, code that previously returned a valid record count from a QODBC-connected Access VBA recordset now returns Affected products: QODBC Desktop, QuickBooks Enterprise 25, MS Access VBA Symptoms:
Cause:The ADO Recordset's default cursor type does not support returning a record count. In older versions of QuickBooks, the server-side cursor happened to return accurate counts despite the default settings. With QuickBooks Enterprise 25, the change in how data is returned means Solution: Set the CursorLocation property to client cursor (value 3 / adUseClient) on the ADO Recordset before opening it. Note
This is tracked internally as B01800 on the QODBC bug list. The fix applies at the ADO client level and works with all QODBC versions. Environment:
Solution:Set the CursorLocation property of your ADO Recordset to adUseClient (3) after creating the recordset object and before opening it. ' Create the recordset object Set rst_QB_cust = New ADODB.Recordset ' Set CursorLocation to client cursor BEFORE opening rst_QB_cust.CursorLocation = 3 ' Now open with your connection string rst_QB_cust.Open strSQL, sConString, adOpenDynamic, adLockOptimistic ' RecordCount now returns the correct value Debug.Print rst_QB_cust.RecordCount SQL Examples:The SQL query itself does not need to change - this is a VBA/ADO configuration issue, not an SQL issue. strSQL = "SELECT ListID, FullName FROM Customer WHERE IsActive = 'True'" rst_QB_cust.Open strSQL, sConString, adOpenDynamic, adLockOptimistic Example Scenarios:Before the fix: An Access VBA application connected to QuickBooks via QODBC worked fine with QB Enterprise v18. After upgrading to QB Enterprise 25, the RecordCount returned After the fix: The CursorLocation was set to 3 on the ADO recordset before opening it. RecordCount now returns the correct number of records. Additional Notes:
Related Articles:How to Match 32-bit and 64-bit DSNs for QODBC QODBC Connection Strings for MS Access VBA Keywords:QODBC RecordCount CursorLocation ADO Access VBA -1 QuickBooks Enterprise 25 B01800 adUseClient ODBC
| |||||||||
|
|
|||||||||


