![]() |
Deleting a Table |
|
Introduction |
To delete a table in the SQL, create a DROP TABLE expression followed by the name of the table. The formula to use is:
DROP TABLE TableName;
Replace the TableName factor of our formula with the name of the table you want to delete. Here is an example:
Private Sub cmdDeleteTable_Click()
Dim conEmployees As ADODB.Connection
Dim strSQL As String
Set conDepartments = New ADODB.Connection
conEmployees.Open "Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Data Source='C:\My Documents\Exercise.accdb'"
strSQL = "DROP TABLE Employees;"
conEmployees.Execute strSQL
MsgBox "The Employees table of the Exercise.accdb database has been deleted."
Set conEmployees = Nothing
End Sub
|
|
||
| Home | Copyright © 2009 FunctionX | |
|
|
||