适用于:Access 2013、Office 2013
返回一个值,该值指示是否可更新 Field 对象所代表的字段中的数据。
语法
表达式 。DataUpdatable
表达式 一个表示 Field 对象的变量。
说明
使用此属性可确定是否可以更改 Field 对象的 Value 属性设置。 对于 Attributes 属性为 dbAutoIncrField 的 Field 对象,该属性始终为 False。
可以对追加到 QueryDef、Recordset 和 Relation 对象的 Fields 集合的 Field 对象使用 DataUpdatable 属性,但不能对 Index 或 TableDef 对象的 Fields 集合使用 DataUpdatable 属性。
示例
以下示例演示使用了六个不同的 Recordsets 中的第一个字段的 DataUpdatable 属性。 若要使该过程运行,需要使用 DataOutput 函数。
Sub DataUpdatableX()
Dim dbsNorthwind As Database
Dim rstNorthwind As Recordset
Set dbsNorthwind = OpenDatabase("Northwind.mdb")
With dbsNorthwind
' Open and print report about a table-type Recordset.
Set rstNorthwind = .OpenRecordset("Employees")
DataOutput rstNorthwind
' Open and print report about a dynaset-type Recordset.
Set rstNorthwind = .OpenRecordset("Employees", _
dbOpenDynaset)
DataOutput rstNorthwind
' Open and print report about a snapshot-type Recordset.
Set rstNorthwind = .OpenRecordset("Employees", _
dbOpenSnapshot)
DataOutput rstNorthwind
' Open and print report about a forward-only-type Recordset.
Set rstNorthwind = .OpenRecordset("Employees", _
dbOpenForwardOnly)
DataOutput rstNorthwind
' Open and print report about a Recordset based on
' a select query.
Set rstNorthwind = _
.OpenRecordset("Current Product List")
DataOutput rstNorthwind
' Open and print report about a Recordset based on a
' select query that calculates totals.
Set rstNorthwind = .OpenRecordset("Order Subtotals")
DataOutput rstNorthwind
.Close
End With
End Sub
Function DataOutput(rstTemp As Recordset)
With rstTemp
Debug.Print "Recordset: " & .Name & ", ";
Select Case .Type
Case dbOpenTable
Debug.Print "dbOpenTable"
Case dbOpenDynaset
Debug.Print "dbOpenDynaset"
Case dbOpenSnapshot
Debug.Print "dbOpenSnapshot"
Case dbOpenForwardOnly
Debug.Print "dbOpenForwardOnly"
End Select
Debug.Print " Field: " & .Fields(0).Name & ", " & _
"DataUpdatable = " & .Fields(0).DataUpdatable
Debug.Print
.Close
End With
End Function