Microsoft KB Archive/101370

{|
 * width="100%"|

ACC1x: "Table Does Not Exist" Error Message When Deleting Table

 * }

Q101370

-

The information in this article applies to:


 * Microsoft Access versions 1.0, 1.1

-

SYMPTOMS
In Microsoft Access version 1.x, if an Access Basic function creates a table with a QueryDef function, and then attempts to delete that table, the following error message appears:

Table does not exist.

The new table does not get deleted, and is not displayed in the Database window until the window is refreshed.

CAUSE
If the Database window is displaying the tables while the function is being run, the Database window must be refreshed to display the new table before it can be deleted.

RESOLUTION
Refresh the Database window before attempting to delete the table. To do this, choose another object (for example, forms) in the Database window, then display the tables again.

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
The following function uses the sample database NWIND.MDB to demonstrate how to create the table and then successfully delete it. Make sure that you choose Table in the Database window before you run the function below.

NOTE: In the following sample code, an underscore (_) is used as a line-continuation character. Remove the underscore when re-creating this code in Access Basic.

  Function DeleteThisTable Dim mydb As Database, myq As QueryDef Set mydb = CurrentDB Set myq = mydb.CreateQueryDef("createtablequery") 'Create the Table myq.sql = "SELECT DISTINCTROW Customers.[Customer ID], _                   Customers.[Company Name] INTO test FROM Customers;" myq.Execute

'Choose any object other than Table to refresh Database 'window. 'NOTE: Omit the following line to reproduce the problem:

DoCmd SelectObject A_FORM, "Customers", True

'Delete the table DoCmd SelectObject A_TABLE, "test", True DoCmd DoMenuItem A_DATABASE, A_EDIT, A_DELETE

End Function Additional query words: QueryDef refresh

Keywords : kberrmsg kbusage

Issue type : kbbug

Technology :