Switchboard causes a compile error after you convert a Access 2000 database to Access 97 (262847)
The information in this article applies to:
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 "Steps to Reproduce the Behavior" section later in this article.
- 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.
- Click the Tables tab. Right-click the Switchboard Items table, and then click Rename. Rename the table to Switchboard Items 2000.
- On the Tools menu, point to Add-ins, and then click Switchboard Manager.
- Click Yes in the dialog box that prompts you to create a new switchboard.
- Click Close to close the Switchboard Manager.
- Click the Tables tab. Rename the Switchboard Items table to Switchboard Items 97.
- Rename the Switchboard Items 2000 table to Switchboard Items.
- Click the Forms tab, and then open the Switchboard form. It should open successfully, and you should be able to use it without errors.
- 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 DAONOTE: 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 "Steps to Reproduce the Behavior" 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("ADODB.Recordset")
Locate the HandleButtonClick() procedure, and make the same modifications that you just made to the FillOptions() procedure. - On the Debug menu, click Compile ProjectName.
- 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 "Steps to Reproduce the Behavior" section later in this article.
The Switchboard form should now open successfully in Microsoft Access 97.
Modification Type: | Minor | Last Reviewed: | 11/18/2004 |
---|
Keywords: | kberrmsg kbprb KB262847 |
---|
|