XL2000: "Could Not Use <File>, File Already in Use" Error Running Microsoft Query

ID: Q235091


The information in this article applies to:
  • Microsoft Excel 2000


SYMPTOMS

When you attempt to connect to a database using Microsoft Query, you receive an error message similar to the following:

Could not use '(unknown)'; file already in use.
Driver's SQLSetConnectAttr failed


CAUSE

This error message occurs if you selected the Exclusive check box in the Select Database dialog box. Microsoft Query requires that the database be shared because it attempts to make two connections to the driver. Exclusive mode allows only one connection.


RESOLUTION

To work around this behavior, use the appropriate method for your situation.

Method 1: If You Need to Have an Exclusive Connection

Make a read-only connection and then modify the .dsn file to make the exclusive connection. To do this, follow these steps:
  1. On the Data menu, point to Get External Data, and then click New Database Query.


  2. Click the Databases tab.


  3. Click <New Data Source> and then click OK.


  4. In the Create New Data Source dialog box, follow these steps:


    1. In the What name do you want to give your data source box, type the name you want. For example, type MyQuery.


    2. In the Select a driver for the type of database you want to access list, click Microsoft Access Driver (*.mdb) and then click Connect.


  5. Click Select.


  6. Select the .mdb file you want to use and click to select the Read-Only and the Exclusive check boxes. Click OK.


  7. Modify the .dsn file. To do this, follow these steps:


    1. On the Start menu, point to Find and then click Files or Folders.


    2. In the Find What box, type the name of the .dsn file. If you used the file name example from step 4, type MyQuery.dsn and then click Find Now.


    3. When found, open this file in Microsoft Notepad and change the "ReadOnly=1" setting to "ReadOnly=0".


    4. Save the file.


  8. Click OK.


Method 2: If You Do Not Have to Have an Exclusive Connection

  1. On the Data menu, point to Get External Data, and then click New Database Query.


  2. Click the Databases tab.


  3. Click <New Data Source> and then click OK.


  4. In the Create New Data Source dialog box, follow these steps:


    1. In the What name do you want to give your data source box, type the name you want. For example, type MyQuery.


    2. In the Select a driver for the type of database you want to access list, click Microsoft Access Driver (*.mdb) and then click Connect.


  5. Click Select.


  6. Select the .mdb file you want to use; click to select the Read-Only check box and then click OK.


  7. Click OK again.


Additional query words: XL2000

Keywords :
Version : WINDOWS:2000
Platform : WINDOWS
Issue type : kbprb


Last Reviewed: November 23, 1999
© 2000 Microsoft Corporation. All rights reserved. Terms of Use.