Microsoft KB Archive/253857

= FIX: Jet DROP TABLE with Non-Existent Table Name Returns Wrong Error Code =

Article ID: 253857

Article Last Modified on 7/14/2004

-

APPLIES TO


 * Microsoft Access 2000 Standard Edition
 * Microsoft Visual Basic 5.0 Professional Edition
 * Microsoft Visual Basic 6.0 Professional Edition
 * Microsoft Visual Basic 5.0 Enterprise Edition
 * Microsoft Visual Basic 6.0 Enterprise Edition

-



This article was previously published under Q253857



SYMPTOMS
When you try to drop a non-existent table using DAO 3.5, you receive the following error message:

3376 Table doesn't exist.

When you try to drop a non-existent table using DAO 3.6, you receive a different error message:

3371 Can't find table or constraint.



CAUSE
The first (more generic) message above is a side-effect of changing Microsoft Jet to allow dropping multiple tables at once.



RESOLUTION
Upgrade to Microsoft Jet 4.0 SP4 or later.



STATUS
This has been fixed so that when dropping a single table and the name does not exist within the database, the old error message is given. However, if dropping multiple tables, and one or more do not exist, the new error message is given.



Steps to Reproduce
 In Microsoft Visual Basic 5.0 or 6.0, create a new Standard EXE project.

In Microsoft Access 2000, open an existing database. Add a form to the project with a Command button (Command1).  Add the following code to the click event of the Command button: Option Explicit

Private Sub Command1_Click Dim db As DAO.Database, E As Long Set db = DBEngine(0).OpenDatabase("nwind.mdb") ' Visual Basic ' Set db = CurrentDB                            ' Access 2000 On Error Resume Next ' the table name must be nonexistent db.Execute "DROP TABLE FOO_BAR_1234", dbFailOnError E = Err Err.Clear MsgBox "Error should be 3376." & vbCrLf & "Actual error: " & E db.Execute "DROP TABLE FOO_BAR_1234, FOO_BAR_3456", dbFailOnError E = Err Err.Clear MsgBox "Error should be 3371." & vbCrLf & "Actual error: " & E db.Close End Sub NOTE: You may have to adjust the path to point to a valid database.

 For Visual Basic, on the Project, select References or, for Access 2000, on the Tools menu, select References and choose the following type library:

Microsoft DAO 3.6 Object Library

 In Visual Basic, run the project.

In Microsoft Access, save and open the form.</li> Click the Command button. If you are using Microsoft Jet 4.0 SP3 or earlier, the actual error number in the first message box does not match the expected error number; those in the second do match. If you are using Microsoft Jet 4.0 SP4 or later, the error numbers in both message boxes match.</li></ol>

Additional query words: doesn t can t

Keywords: kbbug kbfix kbjet KB253857

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.