Skip to content

Latest commit

 

History

History
50 lines (30 loc) · 1.71 KB

Access.DoCmd.DeleteObject.md

File metadata and controls

50 lines (30 loc) · 1.71 KB
title keywords f1_keywords api_name ms.assetid ms.date ms.localizationpriority
DoCmd.DeleteObject method (Access)
vbaac10.chm4147
vbaac10.chm4147
Access.DoCmd.DeleteObject
8e59c5a8-89bd-0d90-9fd1-a1178c73c1c1
03/06/2019
medium

DoCmd.DeleteObject method (Access)

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

Name Required/Optional Data type Description
ObjectType Optional AcObjectType An AcObjectType constant that represents the type of object to delete.
ObjectName Optional Variant A string 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, and then in the current database.

Remarks

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), 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 InDatabaseWindow argument set to Yes (True).

Example

The following example deletes the specified table.

DoCmd.DeleteObject acTable, "Former Employees Table"

[!includeSupport and feedback]