XL7: DAO Error Using OpenDatabase on ODBC Sources

ID: Q133414


The information in this article applies to:


SYMPTOMS

In Microsoft Excel, when you attempt to open a database for use with Data Access Objects, you may receive the following error message:

Run Time Error 3423
You cannot use ODBC to attach (link) an external Microsoft Access or ISAM database table to your database.


CAUSE

This error occurs if you are trying to open a database for which an installable ISAM driver exists, and you are using an ODBC data source to establish the connection to that database.


WORKAROUND

In this situation, you must use the ISAM driver to open the database.

The following two examples demonstrate the syntax for connecting to an external database using Data Access Objects, using ISAM and ODBC drivers.

Microsoft provides examples of Visual Basic procedures for illustration only, without warranty either expressed or implied, including but not limited to the implied warranties of merchantability and/or fitness for a particular purpose. This Visual Basic procedure is provided 'as is' and Microsoft does not guarantee that it can be used in all situations. Microsoft does not support modifications of this procedure to suit customer requirements for a particular purpose.

Before you run either of the following macros, use the following two steps:

  1. In the module sheet that contains the macro, click References and then click Tools.


  2. From the list of references, select the Microsoft DAO 3.0 Object Library, and click OK.

    ODBC
    ----

    NOTE: If you use the dBASE driver in this manner, it will result in the error message listed above.

    
       Sub ODBCMethod()
          Dim db1 As Database
    
          Set db1 = OpenDatabase("c:\test", False, False, _
              "ODBC;DSN=dBASE Files;DBQ=c:\test")
       End Sub
    
       ISAM
       ----
    
       Sub ISAMMethod()
          Dim db1 As Database
          Set db1 = OpenDatabase("c:\test", False, False, "dBASE IV") 
    End Sub



MORE INFORMATION

When you use data access objects in Microsoft Excel for Windows, it is possible to access an external database using either an installable ISAM driver or an ODBC driver. The following are two examples of data base types that can access an external database using either an installable ISAM driver or an ODBC driver:


   Microsoft Excel files
   Text files 




When you use these database types, you do not receive the error message described in the "Symptoms" section of this article .

Additional query words:


Keywords          : kbnetwork xlwin 
Version           : 7.00
Platform          : WINDOWS 
Issue type        : 

Last Reviewed: April 15, 1999