Information
The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.

DROP Statement (Microsoft Access SQL)

Office 2007

Deletes an existing table, procedure, or view from a database, or deletes an existing index from a table.

Bb177897.vs_note(en-us,office.12).gif  Note
The Microsoft Access database engine does not support the use of DROP, or any of the DDL statements, with non-Microsoft Access database engine databases. Use the DAO Delete method instead.
Syntax

DROP {TABLE table | INDEX index ON table | PROCEDURE procedure | VIEW view}

The DROP statement has these parts:

PartDescription
tableThe name of the table to be deleted or the table from which an index is to be deleted.
procedureThe name of the procedure to be deleted.
viewThe name of the view to be deleted.
indexThe name of the index to be deleted from table.
Remarks

You must close the table before you can delete it or remove an index from it.

You can also use ALTER TABLE to delete an index from a table.

You can use CREATE TABLE to create a table and CREATE INDEX or ALTER TABLE to create an index. To modify a table, use ALTER TABLE.

Example

The following example assumes the existence of a hypothetical NewIndex index on the Employees table in the Northwind database.

This example deletes the index MyIndex from the Employees table.

Sub DropX1()

    Dim dbs As Database

    ' Modify this line to include the path to Northwind
    ' on your computer.
    Set dbs = OpenDatabase("Northwind.mdb")

    ' Delete NewIndex from the Employees table.
    dbs.Execute "DROP INDEX NewIndex ON Employees;"

    dbs.Close

End Sub

This example deletes the Employees table from the database.

Sub DropX2()

    Dim dbs As Database

    ' Modify this line to include the path to Northwind
    ' on your computer.
    Set dbs = OpenDatabase("Northwind.mdb")

    ' Delete the Employees table.
    dbs.Execute "DROP TABLE Employees;"

    dbs.Close

End Sub
See Also

ADD USER Statement

ALTER TABLE Statement

ALTER USER or DATABASE Statement

CONSTRAINT Clause

CREATE INDEX Statement

CREATE PROCEDURE Statement

CREATE TABLE Statement

CREATE USER or GROUP Statement

CREATE VIEW Statement

DROP USER or GROUP Statement

GRANT Statement

REVOKE Statement



Community Additions

Show:
© 2014 Microsoft