Sub SetDefaultFieldValue()
Dim conn As ADODB.Connection
Dim strTable As String
Dim strCol As String
Dim strDefVal As String
Dim strSQL As String
On Error GoTo ErrorHandler
Set conn = CurrentProject.Connection
strTable = "myTable"
strCol = "City"
strDefVal = "Boston"
strSQL = "ALTER TABLE " & strTable & _
" ALTER " & strCol & " SET DEFAULT " & strDefVal
conn.Execute strSQL
ExitHere:
conn.Close
Set conn = Nothing
Exit Sub
ErrorHandler:
Debug.Print Err.Number & ":" & Err.Description
Resume ExitHere
End Sub
|