Microsoft KB Archive/821705

= ACC2002: WillChangeRecord Event Does Not Fire on Recordset.Delete =

PSS ID Number: 821705

Article Last Modified on 7/15/2003

-

The information in this article applies to:


 * Microsoft Access 2000
 * Microsoft Access 2002
 * Microsoft Access 97

-



This article applies to a Microsoft Access database (.mdb) and a Microsoft Access project (.adp).

Advanced: Requires expert coding, interoperability, and multiuser skills.



SYMPTOMS
When the Recordset.Delete method is called, the WillChangeRecord event does not fire.



CAUSE
This issue may occur when both the following conditions are true:
 * The CursorLocation property of the ADODB.Recordset object is set to adUseServer.
 * The ActiveConnection property of the ADODB.Recordset object is set to Microsoft.Jet.OLEDB.4.0 (Microsoft Access 2000 database).



RESOLUTION
To resolve this issue, you must obtain the latest Microsoft Jet 4.0 Service Pack that contains an updated version of the Microsoft Jet 4.0 database engine.

For additional information about how to obtain the latest version of the Jet 4.0 database engine, click the following article number to view the article in the Microsoft Knowledge Base:

282010 ACC2002: The Updated Version of Microsoft Jet 4.0 Is Available in the Download Center



STATUS
Microsoft has confirmed that this is a problem in the Microsoft products that are listed at the beginning of this article.

This problem has been resolved in Jet 4.0 Service Pack 7 (SP7).



Steps to Reproduce the Problem
 Create a new Microsoft Visual Basic 6.0 project and then add a reference to Microsoft ActiveX Data Objects 2.6 Library.  Copy and then paste the following declarations in the &quot;General Declarations&quot; section of the code view for the default form (Form1). Private adoCN as ADODB.Connection Private WithEvents adoRS as ADODB.Recordset   Copy and then paste the following code in the Form1_Load event. Set adoCN = New ADODB.Connection adoCN.CursorLocation = adUseServer adoCN.Open &quot;Provider=Microsoft.Jet.OLEDB.4.0;&quot; & _ &quot;Data Source=>path<\NWIND2K.MDB&quot; Set adoRS = New ADODB.Recordset adoRS.Open &quot;SELECT * FROM CUSTOMERS&quot;, adoCN, _ adOpenForwardOnly, adLockOptimistic, adCmdText

adoRS.AddNew Array(&quot;CUSTOMERID&quot;, &quot;COMPANYNAME&quot;, _                    &quot;CONTACTNAME&quot;, &quot;CONTACTTITLE&quot;, _                     &quot;ADDRESS&quot;, &quot;CITY&quot;, &quot;REGION&quot;), _ Array(&quot;TSTCO&quot;, &quot;Test Company&quot;, _            &quot;Nancy Davolio&quot;, &quot;VP&quot;, _             &quot;1234 Sesame St.&quot;, &quot;NY&quot;, &quot;NY&quot;) adoRS.Update adoRS.Delete   Copy and then paste the following code in the adoRS_WillChangeRecord event.

Debug.Print &quot;WillChangeRecord adReason = &quot; & adReason  Step through the project. Notice that no event is fired for the Recordset.Delete call.</li></ol>

Additional query words: BeforeDelete

Keywords: kbQFE kbBug KB821705

Technology: kbAccess2000 kbAccess2000Search kbAccess2002 kbAccess2002Search kbAccess97 kbAccess97Search kbAccessSearch

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© 2003 Microsoft Corporation. All rights reserved.