Notice: This website is an unofficial Microsoft Knowledge Base (hereinafter KB) archive and is intended to provide a reliable access to deleted content from Microsoft KB. All KB articles are owned by Microsoft Corporation. Read full disclaimer for more details.

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


View products that this article applies to.

This article was previously published under Q235091

↑ Back to the top


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

↑ Back to the top


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.

↑ Back to the top


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.

↑ Back to the top


Keywords: KB235091, kbpending, kbprb

↑ Back to the top

Article Info
Article ID : 235091
Revision : 3
Created on : 11/5/2003
Published on : 11/5/2003
Exists online : False
Views : 214