DROP Statement Example (DAO)

Microsoft Jet SQL Reference

DROP Statement 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