发布网友 发布时间:2022-04-24 02:03
共1个回答
热心网友 时间:2023-10-20 17:05
Sub AppendDescriptionToField(ByVal TableName As String, ByVal FieldName As String, ByVal Description As String)
On Error GoTo ErrP
Dim TDS As TableDefs
Dim TD As TableDef
Dim F As .Field
Dim P As Property
Set TDS = CurrentDb.TableDefs
Set TD = TDS(TableName)
Set F = TD.Fields(FieldName)
Set P = F.CreateProperty("Description", dbText, Description)
F.Properties.Append P
ExitSub:
Set P = Nothing
Set F = Nothing
Set TD = Nothing
Set TDS = Nothing
Exit Sub
ErrP:
If Err.Number = 3367 Then
F.Properties("Description") = Description
Else
MsgBox Err.Number & " " & Err.Description
End If
GoTo ExitSub
End Sub
复制上面的代码到一个模块中,在其他在方就可以调用了
使用方法
AppendDescriptionToField "表名","字段名","该字段的说明文本"
热心网友 时间:2023-10-20 17:05
Sub AppendDescriptionToField(ByVal TableName As String, ByVal FieldName As String, ByVal Description As String)
On Error GoTo ErrP
Dim TDS As TableDefs
Dim TD As TableDef
Dim F As .Field
Dim P As Property
Set TDS = CurrentDb.TableDefs
Set TD = TDS(TableName)
Set F = TD.Fields(FieldName)
Set P = F.CreateProperty("Description", dbText, Description)
F.Properties.Append P
ExitSub:
Set P = Nothing
Set F = Nothing
Set TD = Nothing
Set TDS = Nothing
Exit Sub
ErrP:
If Err.Number = 3367 Then
F.Properties("Description") = Description
Else
MsgBox Err.Number & " " & Err.Description
End If
GoTo ExitSub
End Sub
复制上面的代码到一个模块中,在其他在方就可以调用了
使用方法
AppendDescriptionToField "表名","字段名","该字段的说明文本"
热心网友 时间:2023-10-20 17:05
Sub AppendDescriptionToField(ByVal TableName As String, ByVal FieldName As String, ByVal Description As String)
On Error GoTo ErrP
Dim TDS As TableDefs
Dim TD As TableDef
Dim F As .Field
Dim P As Property
Set TDS = CurrentDb.TableDefs
Set TD = TDS(TableName)
Set F = TD.Fields(FieldName)
Set P = F.CreateProperty("Description", dbText, Description)
F.Properties.Append P
ExitSub:
Set P = Nothing
Set F = Nothing
Set TD = Nothing
Set TDS = Nothing
Exit Sub
ErrP:
If Err.Number = 3367 Then
F.Properties("Description") = Description
Else
MsgBox Err.Number & " " & Err.Description
End If
GoTo ExitSub
End Sub
复制上面的代码到一个模块中,在其他在方就可以调用了
使用方法
AppendDescriptionToField "表名","字段名","该字段的说明文本"