ACC: RecordsAffected Property Incorrect for SQL Pass-ThroughLast reviewed: August 29, 1997Article ID: Q163703 |
The information in this article applies to:
SYMPTOMSModerate: Requires basic macro, coding, and interoperability skills. When you use the RecordsAffected property of a Database or QueryDef object to determine the number of records affected by the Execute method, the value is incorrect with SQL pass-through queries. This article assumes that you are familiar with Visual Basic for Applications and with creating Microsoft Access applications using the programming tools provided with Microsoft Access. For more information about Visual Basic for Applications, please refer to your version of the "Building Applications with Microsoft Access" manual.
CAUSEThe RecordsAffected property is not set when you execute a pass-through query.
STATUSThis behavior is by design.
MORE INFORMATIONWhen you view the RecordsAffected property, it reflects the number of records affected by the most recent Execute method on an object that uses the Microsoft Jet database engine. Pass-through queries bypass the Jet database engine and interact directly with the back-end database through the ODBC driver. The following example shows a correct RecordsAffected value because the Execute method operates on a table in the sample database Northwind.mdb:
Steps to Reproduce BehaviorThe following example uses an ODBC connection to the Pubs database in Microsoft SQL Server. Substitute the correct parameters for your ODBC database in the OpenDatabase method. NOTE: If the number of records affected by the most recent Execute method in your current instance of Microsoft Access happens to be 2, the RecordsAffected property will return the correct number of records. Quit and restart Microsoft Access to ensure that you reproduce the desired results from this example.
REFERENCESFor more information about the RecordsAffected property, search the Help Index for "RecordsAffected property." Keywords : kbusage ODBCSPT QryPass MdlQry Version : 7.0 97 Platform : WINDOWS Hardware : x86 Issue type : kbprb Solution Type : Info_Provided |
================================================================================
© 1998 Microsoft Corporation. All rights reserved. Terms of Use. |