Microsoft KB Archive/225061

= ACC2000: OnEnter Event Occurs Each Time That You Move to a Different Record =

Article ID: 225061

Article Last Modified on 6/24/2004

-

APPLIES TO


 * Microsoft Access 2000 Standard Edition

-



This article was previously published under Q225061



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

Moderate: Requires basic macro, coding, and interoperability skills.



SYMPTOMS
The OnEnter event for a control occurs each time that you move to a different record on a form.



CAUSE
The control that has the OnEnter event has the focus as you move through the form.



STATUS
This behavior is by design.



MORE INFORMATION
CAUTION: If you follow the steps in this example, you modify the sample database Northwind.mdb. You may want to back up the Northwind.mdb file and follow these steps on a copy of the database.

Steps to Reproduce the Behavior
 Open the sample database Northwind.mdb or the sample Access project NorthwindCS.adp. In the Database window, click Tables under Objects, click the Orders table, and then on the Insert menu, click AutoForm. On the View menu, click Design View.  Set the OnEnter property of the OrderDate text box to the following event procedure: Option Compare Database Option Explicit

Private Sub OrderDate_Enter Me!OrderDate = Date End Sub  On the Debug menu, click Compile <DbName>.</li> Close the Visual Basic Editor, and on the View menu in Access, click Form View.</li> Move through the first 5 or 6 records. Note that the dates appear as expected in the Order Date box.</li> Return to the first record, and then click in the Order Date box. Note that the first record and every other record that you move to immediately changes to today's date as the OnEnter event occurs as you move through the records.</li></ol>

Additional query words: current date fire fires execute executes happens format short prb

Keywords: kbprb KB225061

-

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

© Microsoft Corporation. All rights reserved.