Microsoft KB Archive/160500

= ACC97: Compilation Error After Converting NWIND.MDB in Access 97 =

Article ID: 160500

Article Last Modified on 1/19/2007

-

APPLIES TO


 * Microsoft Access 97 Standard Edition

-



This article was previously published under Q160500



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



SYMPTOMS
When you convert the Microsoft Access 2.0 sample database NWIND.MDB to Microsoft Access 97, you receive the following error message:

There were compilation errors during the conversion or enabling of this database.



CAUSE
The version of Microsoft Visual Basic for Applications in Microsoft Access 97 has the same naming restrictions as the full version of Microsoft Visual Basic 5.0. This version of Visual Basic for Applications now restricts the use of the following keywords as identifiers in a Visual Basic for Applications module:

AddressOf, Decimal, DefDec, Enum, Event, Friend, Implements, RaiseEvent, WithEvents

When you convert a database from an earlier version of Microsoft Access to Microsoft Access 97, existing identifiers that are the same as new Visual Basic keywords cause a compile error.

In this example, NWIND.MDB uses an identifier called Event in the ShowEvent procedure of the Utility Functions module.



RESOLUTION
After you convert NWIND.MDB to Microsoft Access 97, do the following to fully compile the project:

 Start Microsoft Access and open the converted NWIND.MDB. Open the Utility Functions module in Design view. On the Debug menu, click Compile Loaded Modules. Click OK when you receive the compile error message.  Modify the ShowEvent procedure to read as follows:

Sub ShowEvent (Event_var As String) ' Accepts: a text value, the type or name of an object and the name ' of an event. ' Purpose: displays an event history list in the Event History form.

If IsNull(Forms![Event History]![History]) Then Forms![Event History]![History] = Event_var Else Forms![Event History]![History] = Event_var & Chr(13) & _ Chr(10) & Forms![Event History]![History] End If     End Sub  On the Debug menu, click Compile and Save All Modules.</li></ol>

<div class="moreinformation_section">

Steps to Reproduce Behavior
<ol> Start Microsoft Access 97 and open the Microsoft Access 2.0 sample database NWIND.MDB.</li> In the Convert/Open Database dialog box, click Convert Database. Note that you receive the following warning message during conversion:

There were compilation errors during the conversion or enabling of this database.

</li></ol>

<div class="references_section">