Microsoft KB Archive/262847

= Switchboard causes a compile error after you convert a Access 2000 database to Access 97 =

Article ID: 262847

Article Last Modified on 1/27/2007

-

APPLIES TO


 * Microsoft Access 97 Standard Edition

-



This article was previously published under Q262847



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



SYMPTOMS
When you open a Switchboard form in a Microsoft Access 97 database that was converted from Microsoft Access 2000, you receive the following error message:

Compile error: Method or data member not found.

Microsoft Access then highlights the following line of code in the Switchboard form. Set con = Application.CurrentProject.Connection



CAUSE
The Visual Basic for Applications code in the Switchboard form refers to the Application.CurrentProject.Connection property, which is not available in Microsoft Access 97.



RESOLUTION
There are two possible solutions to this problem.

Solution 1: Re-create the Switchboard form in Microsoft Access 97
The Switchboard Manager creates and modifies two main objects: the Switchboard Items table, and the Switchboard form. The Switchboard Items table contains all the information that defines the items on the Switchboard, and this information has not significantly changed since Microsoft Access 97. Therefore, you can use the Switchboard Manager in Microsoft Access 97 to re-create the Switchboard form by using the Switchboard Items table from Microsoft Access 2000.

NOTE: The following example assumes that you have already converted a database with a Switchboard form from Access 2000 to Access 97. If you have questions about how to do this, follow steps 1 through 17 in the &quot;Steps to Reproduce the Behavior&quot; section later in this article.
 * 1) After opening the database in Microsoft Access 97, click the Forms tab. Right-click the Switchboard form, and then click Rename. Rename the form to Switchboard 2000.
 * 2) Click the Tables tab. Right-click the Switchboard Items table, and then click Rename. Rename the table to Switchboard Items 2000.
 * 3) On the Tools menu, point to Add-ins, and then click Switchboard Manager.
 * 4) Click Yes in the dialog box that prompts you to create a new switchboard.
 * 5) Click Close to close the Switchboard Manager.
 * 6) Click the Tables tab. Rename the Switchboard Items table to Switchboard Items 97.
 * 7) Rename the Switchboard Items 2000 table to Switchboard Items.
 * 8) Click the Forms tab, and then open the Switchboard form. It should open successfully, and you should be able to use it without errors.
 * 9) Close the Switchboard form.

After you verify that the Switchboard form works correctly, you can permanently delete the Switchboard Items 97 table and the Switchboard 2000 form.

Solution 2: Replace the ADO code in the Switchboard form with DAO
NOTE: The following example assumes that you have already created an Access 2000 database with a Switchboard form. If you have questions about how to do this, follow steps 1 through 17 in the &quot;Steps to Reproduce the Behavior&quot; section later in this article.  Open the Switchboard form in Design View. On the View menu, click Code to open the form's module in the Visual Basic Editor.  Locate the FillOptions procedure, and make the following modifications to it.

Replace the following line of code Set con = Application.CurrentProject.Connection with: Set con = CurrentDb Replace the following line of code rs.Open stSql, con, 1  ' 1 = adOpenKeyset with: Set rs = con.OpenRecordset(stSql) Remove the following line of code: Set rs = CreateObject(&quot;ADODB.Recordset&quot;) Locate the HandleButtonClick procedure, and make the same modifications that you just made to the FillOptions procedure.  On the Debug menu, click Compile . Close and save the Switchboard form. Convert the database to Access 97. For additional information on how to do this, follow steps 15 through 17 in the &quot;Steps to Reproduce the Behavior&quot; section later in this article.</li></ol>

The Switchboard form should now open successfully in Microsoft Access 97.

<div class="moreinformation_section">

MORE INFORMATION
The code in the Switchboard form was updated in Microsoft Access 2000 to use ActiveX Data Objects (ADO). In order to obtain an ADO connection to the currently open database, the code in the Switchboard form refers to the Application.CurrentProject.Connection property. This property is new to Microsoft Access 2000 and is not available in Microsoft Access 97.

Steps to Reproduce the Behavior
<ol> Start Microsoft Access 2000.</li> Open the sample database Northwind.mdb.</li> On the Tools menu, point to Database Utilities, and then click Switchboard Manager.</li> Click Yes in the dialog box that prompts you to create a new switchboard.</li> In the Switchboard Manager dialog box, click Edit.</li> In the Edit Switchboard Page dialog box, click New.</li> In the Edit Switchboard Item dialog box, type the following:

</li> In the Edit Switchboard Item dialog box, click OK.</li> In the Edit Switchboard Page dialog box, click Close.</li> In the Switchboard Manager, click Close.</li> In the Database window, click Forms under Objects.</li> Open the Switchboard form in Form view.</li> Click the Edit Customers button to verify that the Switchboard form will open the Customers form.</li> Close the Customers form and the Switchboard form.</li> On the Tools menu, point to Database Utilities, point to Convert Database, and then click To Prior Access Database Version.</li> <li>Type Northwind97, and then click Save.</li> <li>Open Northwind97.mdb in Microsoft Access 97. Click OK to the message that the Visual Basic for Applications code has been converted.</li> <li> After the conversion process is finished, open the Switchboard form. Note that you receive the error:

Compile error: Method or data member not found.

Microsoft Access then highlights the following line of code in the Switchboard form. Set con = Application.CurrentProject.Connection </li></ol>

Additional query words: prb switch board

Keywords: kberrmsg kbprb KB262847

-

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

© Microsoft Corporation. All rights reserved.