ACC1x: "Table Does Not Exist" Error Message When Deleting TableID: Q101370
|
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.
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.
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.
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.
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 TblModfy
Version : 1.0 1.1
Platform : WINDOWS
Issue type : kbbug
Last Reviewed: March 25, 1999