Sub Index_WithPrimaryOption()
Dim conn As ADODB.Connection
Dim strTable As String
On Error GoTo ErrorHandler
Set conn = CurrentProject.Connection
strTable = "myTable"
conn.Execute "CREATE INDEX idxPrimary1 ON " & strTable _
& "(SId) WITH PRIMARY ;"
ExitHere:
conn.Close
Set conn = Nothing
Exit Sub
ErrorHandler:
Debug.Print Err.Number & ":" & Err.Description
Resume ExitHere
End Sub
|