ACC95: "Table '<Name>' Already Exists" Make-Table Query Error Message (140635)
The information in this article applies to:
- Microsoft Access for Windows 95 7.0
This article was previously published under Q140635
Moderate: Requires basic macro, coding, and interoperability skills.
SYMPTOMS
When you try to run a make-table parameter query more than once, you may
receive the following error message and the query may not create the
table:
Table '<name>' already exists.
NOTE: This also occurs in Microsoft Access 97 if the database is converted
from Microsoft Access 2.0 and the table already exists.
RESOLUTION
If a make-table parameter query creates a table with the same name as an
existing table, try one of these methods to avoid the error message
mentioned in the "Symptoms" section:
- Delete the existing table before running the query. If you want to
automate this process, you can create a custom function to test for
an existing table. If a table already exists, you can delete the table
and then create a new table by running the make-table query.
- Run a delete query that removes all records from the existing
table followed by an append parameter query to add records to the
empty table.
- Open the make-table parameter query in Design view and modify it
as follows:
- Remove all explicitly defined parameters from the query. To do so,
click Parameters on the Query menu, and then delete any items
listed in the Parameters box.
- In the query design grid, enclose the parameters within an Eval()
function. For example:
Field: OrderID
Table: Orders
Criteria: =Eval("Forms!Form1!OrderID")
- Run the query. Note that you receive a message that says the table
already exists and that asks if you want to continue. You can click
Yes to overwrite the existing table.
- Create a custom function using Visual Basic for Applications that
returns the value of a parameter. Then, you can call the function
from the make-table query, which passes the parameter value to the
query when it is run. For example, to pass a long integer value (from
a form) as a parameter, follow these steps:
- Create a module and type the following procedure:
Function ReturnID() As Long
ReturnID=Forms!Orders!OrderID
End Function
- Open the make-table parameter query in Design view.
- Replace the parameter in the criteria row with the ReturnID()
function:
Field: OrderID
Table: Orders
Criteria: =ReturnID()
- Run the query. Note that you receive a message that says the table
already exists and that asks if you want to continue. Click Yes to
overwrite the existing table.
STATUS
Microsoft has confirmed this to be a problem in Microsoft Access 7.0. This
problem no longer occurs in Microsoft Access 97.
REFERENCES
For more information about make-table queries, search on the phrase "make
table," and then view "Create a new table from the results of a query with
a make-table query" using the Answer Wizard from the Microsoft Access for
Windows 95 Help menu.
Modification Type: | Major | Last Reviewed: | 7/5/2002 |
---|
Keywords: | kbbug kberrmsg KB140635 |
---|
|