你這樣試試看:
Dim FIELD1 AS FIELD
Set RST = CurrentDb.TableDefs("BB").FIELDS("BB1")
SetProperty RST,"CAPTION", True
RST("BB").Fields("BB").CAPTION = "BB1"
'CAPTION是隱藏有屬性.
Sub SetProperty(dbsTemp As Field, strName As String, booTemp As Boolean)
Dim prpNew As Property
Dim errLoop As Error
On Error GoTo Err_property
dbsTemp.Properties("strName") = booTemp
On Error GoTo 0
Exit Sub
Err_property:
If DBEngine.Errors(0).Number = 3270 Then
Set prpNew = dbsTemp.CreateProperty(strName, dbBoolean, booTemp)
dbsTemp.Properties.Append prpNew
Resume Next
Else
For Each errLoop In DBEngine.Errors
MsgBox "Error number: " & errLoop.Number & vbCr & errLoop.Description
Next errLoop
End
End If
End Sub
我這里測試沒成功,老是出錯(有發新貼),你試試看,我想是應該可以的,
不知總是錯在哪里....
試了一天...過分...