Notice: This website is an unofficial Microsoft Knowledge Base (hereinafter KB) archive and is intended to provide a reliable access to deleted content from Microsoft KB. All KB articles are owned by Microsoft Corporation. Read full disclaimer for more details.

ACC2000: Deleting Nonexistent Object Returns Error Code 7874 Not 3011


View products that this article applies to.

Symptoms

When you use the DeleteObject method to programmatically delete an object that does not exist, you may receive the following error message:
Run-time error '7874':

Microsoft Access can't find the object <objectname>
Under the same circumstances, earlier versions of Access display the following error message:
Run-time error '3011':

The Microsoft Jet database engine could not find the object <objectname>. Make sure the object exists and that you spell its name and the path name correctly.

↑ Back to the top


Cause

Microsoft Access 2000 provides a native OLE DB user and programming interface that enables you to access a Microsoft Access database, a Microsoft SQL Server database, and other data sources. Because error code 3011 is specific to the Jet database engine, the error code has been changed to comply with the other data sources.

↑ Back to the top


Resolution

If you have implemented error checking that checks for conditions where the error number = 3011, modify the error checking to reference the number returned in Access 2000. For example, replace
MyErrorCheck:
   If Err.Number = 3011 Then
      ' Do something here
   End If
				
with:
MyErrorCheck:
   If Err.Number = 7874 Then
      ' Do something here
   End If
				

↑ Back to the top


More information

Steps to Reproduce Behavior

  1. Open the sample database Northwind.mdb.
  2. Create a module and type the following line in the Declarations section if it is not already there:
    Option Explicit
    					
  3. Type the following procedure:
     
    Sub Test()
       DoCmd.DeleteObject acTable, "XXX"
    End Sub
    					
  4. To test this function, type the following line in the Immediate window, and then press ENTER:
    Test
    						
    Note that you receive the error message mentioned in the "Symptoms" section.
  5. Repeat steps 1 through 4 in the sample project NorthwindCS.adp and note that you receive the same error message.

↑ Back to the top


Keywords: KB237592, kbprb

↑ Back to the top

Article Info
Article ID : 237592
Revision : 2
Created on : 6/29/2004
Published on : 6/29/2004
Exists online : False
Views : 293