Sub DeleteIndex()
Dim conn As ADODB.Connection
Dim strTable As String
Dim strIdx As String
On Error GoTo ErrorHandler
Set conn = CurrentProject.Connection
strTable = "myTable"
strIdx = "pKey"
conn.Execute "ALTER TABLE " & strTable & " DROP CONSTRAINT " & strIdx & ";"
ExitHere:
conn.Close
Set conn = Nothing
Exit Sub
ErrorHandler:
MsgBox Err.Number & ":" & Err.Description
Resume ExitHere
End Sub
|