Want to rename a column in a table. Tried using this:
But it does not accomplish that task. Any ideas?
Thanks.
Code:
sChkField = "Birthdate"
If FieldExists(rs, sChkField) Then
sAlter = "ALTER TABLE Members RENAME COLUMN BirthDate TO DOB"
cn.Execute sAlter
End If
Private Function FieldExists(r As ADODB.Recordset, sFieldName As String) As Boolean
Dim fld As Field
sSql = "SELECT * FROM Members"
rs.Open sSql, cn
For Each fld In r.Fields
If fld.Name = sFieldName Then
FieldExists = True
Exit For
End If
Next fld
r.Close
Set fld = Nothing
End Function
Thanks.