如何使用程序修改access数据库中数据表的字段名
1个回答
展开全部
Sub EditFieldName(ByVal TableName As String, ByVal FieldName As String, ByVal NewFieldName As String)
On Error GoTo ErrP
Dim TDS As TableDefs
Dim TD As TableDef
Dim F As dao.Field
Set TDS = CurrentDb.TableDefs
Set TD = TDS(TableName)
Set F = TD.Fields(FieldName)
F.Properties("Name") = NewFieldName
ExitSub:
Set F = Nothing
Set TD = Nothing
Set TDS = Nothing
Exit Sub
ErrP:
MsgBox Err.Number & " " & Err.Description
GoTo ExitSub
End Sub
三个参数,第一个表名,第二个是原字段名,第三个是新字段名
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询