DOCUMENT:Q190663 07-AUG-1998 [vbwin] TITLE :PRB: Opening an ODBC Database Inside a Jet Workspace Hangs VB PRODUCT :Microsoft Visual Basic for Windows PROD/VER: OPER/SYS:WINDOWS KEYWORDS: ====================================================================== --------------------------------------------------------------------- The information in this article applies to: - Microsoft Visual Basic for Windows Learning, Professional, and Enterprise Editions, version 6.0 - Microsoft Visual Basic Enterprise Edition for Windows, version 5.0 --------------------------------------------------------------------- SYMPTOMS ======== Attempting to use a Jet workspace to open an ODBC datasource based on a Jet database can cause Visual Basic to hang. This is essentially causing Jet to talk to itself. This is not a supported way of accessing an Access/Jet database. RESOLUTION ========== You can use an ODBC workspace to open an ODBC datasource based on a Jet database. You can also open a Jet database directly, without an using an ODBC datasource. STATUS ====== Microsoft is researching this problem and will post new information here in the Microsoft Knowledge Base as it becomes available. MORE INFORMATION ================ Steps to Reproduce Behavior --------------------------- 1. In 32-bit ODBC Administrator, create a new File DSN based on the Access ODBC driver. For the database, select the NWind.mdb file that is in the Visual Basic program folder. Name the new File DSN NWind. 2. In Visual Basic, create a new Standard EXE Project. Form1 is created by default. 3. Select the Project menu, and choose Remove Form1. 4. Select Project, References and add a reference to the Microsoft DAO 3.51 Object Library. 5. Select Project, Add Module to add a new code module. In the new module's code window, add the following code: Sub main() Dim ws as DAO.Workspace Dim db as DAO.Database Set ws = CreateWorkspace("ws", "admin", "", dbUseJet) Set db = ws.OpenDatabase("", , False, "odbc;") End Sub 6. Save the module as TestHang.BAS and the project as TestHang.VBP. 7. Test the project: a. Press F5 to run the code. From the Select Data Source dialog box, select the NWind.dsn File Data Source. Visual Basic will hang. Press CTRL+ALT+DEL to end the TestHang application and Visual Basic. b. Restart Visual Basic. Open the TestHang project. In the code module, change the workspace from dbUseJet to dbUseODBC: Set ws = CreateWorkspace("ws", "admin", "", dbUseODBC) Press the F5 key to run the code. From the Select Data Source dialog box, select the NWind.dsn File Data Source. Visual Basic will not hang. REFERENCES ========== Microsoft Visual Basic Books Online, Guide to Data Access Objects Additional query words: kbDAO350 kbJET kbdse kbDSupport kbVBp kbVBp500 kbVBp600 ====================================================================== Platform : WINDOWS Issue type : kbprb ============================================================================= THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY. Copyright Microsoft Corporation 1998.