Microsoft KB Archive/109353

{|
 * width="100%"|

ACC1x: "Database Already in Use" Error After Running Query

 * }

Q109353

-

The information in this article applies to:


 * Microsoft Access versions 1.0, 1.1

-

SYMPTOMS
You receive the error message "Couldn't use ' '; database already in use" when you close a database after running a query containing a subquery or crosstab query based on an empty table or another query.

You must quit Microsoft Access and restart it in order to restore proper operation. In some cases, the database may become corrupted, and may result in a database that remains corrupted even after you run the Repair Database command and receive notification that the database was repaired successfully.

RESOLUTION
To work around this problem, add some records to the empty underlying table. Or, you can use a DLookUp function to make sure all referenced tables contain records before running the query.

STATUS
Microsoft has confirmed this to be a problem in Microsoft Access versions 1.0 and 1.1. This problem no longer occurs in Microsoft Access version 2.0.

MORE INFORMATION
If a parameter query is the subquery for a query, and you do not enter anything in the parameter box, the subquery will return an empty set, and will cause the error stated above.

Steps to Reproduce Problem
 Start Microsoft Access and either create a new database or open one of your choosing.  Create a new table called Table1 with the following structure:

     Field   Type f1     text f2     text f3     text z1     long integer   Create another new table called Table2 with the following structure:

      Field   Type f4     text f5     text z2     long integer  Create a new query called Query1 based on Table1. Click the Totals button. Drag all fields from Table1 to the query grid.  Choose Group By in the Total row for all fields. The SQL statement (choose SQL from the View menu) should look like:

<pre class="FIXEDTEXT">      SELECT DISTINCTROW Table1.f1, Table1.f2, Table1.f3, Table1.z1       FROM Table1 GROUP BY Table1.f1, Table1.f2, Table1.f3, Table1.z1      WITH OWNERACCESS OPTION; </li> Create a second query called Query2. Add Query1 and Table2 to the new query.</li> Place a join line between field z1 in Query1 and field z2 in Table2.</li>  Drag the f1 and f2 fields from Query1 to the query grid. The SQL statement should look like:

<pre class="FIXEDTEXT">      SELECT  DISTINCTROW Query1.f1, Query1.f2       FROM Query1, Table2, Query1 INNER JOIN Table2 ON Query1.z1 = Table2.z2      WITH OWNERACCESS OPTION; </li> Do not enter any data. Instead, open Query2 and close the database from the Control menu of the Database window.</li></ol>

Additional query words: Queries

Keywords : kbusage

Issue type : kbbug

Technology :