Table of contents
TOC
Collapse the table of content
Expand the table of content

DoCmd.DeleteObject Method (Access)

office 365 dev account|Last Updated: 6/12/2017
|
1 Contributor

The DeleteObject method carries out the DeleteObject action in Visual Basic.

Syntax

expression. DeleteObject( ** ObjectType, ** ObjectName )

expression A variable that represents a DoCmd object.

Parameters

NameRequired/OptionalData TypeDescription
ObjectTypeOptionalAcObjectTypeA AcObjectType constant that represents the type of object to delete.
ObjectNameOptionalVariantstring expression that's the valid name of an object of the type selected by the objecttype argument. If you run Visual Basic code containing the DeleteObject method in a library database, Microsoft Access looks for the object with this name first in the library database, then in the current database.

Remarks

You can use the DeleteObject method to delete a specified database object.

If you leave the objecttype and objectname arguments blank (the default constant, acDefault, is assumed for objecttype), Microsoft Access deletes the object selected in the Database window. To select an object in the Database window, you can use the SelectObject action or SelectObject method with the In Database Window argument set to Yes ( True ).

Example

The following example deletes the specified table:

DoCmd.DeleteObject acTable, "Former Employees Table"

See also

Concepts

DoCmd Object

© 2017 Microsoft