Sub ChangeFieldType()
Dim conn As ADODB.Connection
Dim strTable As String
Dim strCol As String
On Error GoTo ErrorHandler
Set conn = CurrentProject.Connection
strTable = "myTable"
strCol = "ID"
conn.Execute "ALTER TABLE " & strTable & " ALTER COLUMN " & strCol & " CHAR(15);"
ExitHere:
conn.Close
Set conn = Nothing
Exit Sub
ErrorHandler:
MsgBox Err.Number & ":" & Err.Description
Resume ExitHere
End Sub
|