HandsOn Deleting an Index

1. Switch to the Visual Basic Editor window and insert a new module.

2. In the module's Code window, enter the DeleteIndex procedure as shown below.

Sub DeleteIndex()

Dim conn As ADODB.Connection Dim strTable As String

On Error GoTo ErrorHandler

Set conn = CurrentProject.Connection strTable = "Supplier1"

conn.Execute "DROP INDEX idxSupplierName ON " & strTable & ";" ExitHere:

conn.Close Set conn = Nothing Exit Sub ErrorHandler:

MsgBox Err.Number & ":" & Err.Description Resume ExitHere End Sub

0 0

Post a comment