Jet Doesn't Support QueryDefs on a Non-Attached ODBC TableLast reviewed: July 19, 1996Article ID: Q149055 |
The information in this article applies to:
SUMMARYJet does not support named QueryDefs on a non-attached ODBC database. A non attached ODBC database is one that is opened directly with the OpenDatabase method of the WorkSpace object without the use of an .mdb file.
STATUSThis behavior is by design because Jet does not have a place to store the QueryDef object on the ODBC source.
WORKAROUNDThe preferred method for opening an external ODBC table is to attach it to an .mdb file. For additional information, please see the following article(s) in the Microsoft Knowledge Base:
ARTICLE-ID: Q150716 TITLE : DAO: How To Attach to and Create QueryDefs on ODBC TablesIf this method is not appropriate for your application, the following example shows how to createQuerydefs with no name:
Set qd = db.CreateQueryDef("") qd.SQL = "Select * from authors" MORE INFORMATION
Steps to Reproduce Behavior
In many cases, attaching a table is a faster way to access external data than opening a table directly, especially when the data is located in an ODBC database. In Visual Basic version 4.0, you can even use SQL Passthrough to directly query attached ODBC databases. If possible, it's best to consider attaching external tables rather than opening them directly. If you're using external data in an ODBC database and your particular situation requires opening the external tables directly, keep in mind that performance will be significantly slower when you are using the data.
Sample ProgramThe following example describes how to create a Querydef with no name. There is no need to set up a DSN with the ODBC Admin utility as it uses a "DSN-less" ODBC connection.
REFERENCESJet Database Engine Programmer's Guide, Microsoft Press, page 323
|
Additional reference words: 4.00 vb4win
© 1998 Microsoft Corporation. All rights reserved. Terms of Use. |