'---------------------------------------------------------------------------------------
' Procedure : SetAccessProperty
' DateTime : 10.02.2012 10:17
' Author : Дядя Федор
'---------------------------------------------------------------------------------------
'обращение SetAccessProperty db.TableDefs("TblPrice").Fields(j), "Description", dbMemo, "тратата"
Function SetAccessProperty(obj As Object, strName As String, _
intType As Integer, varSetting As Variant) As Boolean
Dim prp As Property
Const conPropNotFound As Integer = 3270
On Error GoTo ErrorSetAccessProperty
' Explicitly refer to Properties collection.
obj.Properties(strName) = varSetting
obj.Properties.Refresh
SetAccessProperty = True
ExitSetAccessProperty:
Exit Function
ErrorSetAccessProperty:
If Err = conPropNotFound Then
' Create property, denote type, and set initial value.
Set prp = obj.CreateProperty(strName, 10, varSetting)
' Append Property object to Properties collection.
obj.Properties.Append prp
obj.Properties.Refresh
SetAccessProperty = True
Resume ExitSetAccessProperty
Else
MsgBox Err & ": " & vbCrLf & Err.Description
SetAccessProperty = False
Resume ExitSetAccessProperty
End If
End Function
|