Access.2007.VBA.Bibl..

(John Hannent) #1
ErrorHandler:
If err.Number = 3270 Then

The property was not found; create it:

Set prp = dbsCalling.CreateProperty(Name:=strName, _
Type:=lngType, Value:=varValue)
dbsCalling.Properties.Append prp
Resume Next
Else
MsgBox “Error No: “ & err.Number _
& “; Description: “ & err.Description
Resume ErrorHandlerExit
End If

End Sub

Public Function GetProperty(strName As String, _
strDefault As String) As Variant
‘Called from various procedures

On Error GoTo ErrorHandler

Attempt to get the value of the specified property:

Set dbsCalling = CurrentDb
GetProperty = dbsCalling.Properties(strName).Value

ErrorHandlerExit:
Exit Function

ErrorHandler:
If err.Number = 3270 Then

The property was not found; use default value:

GetProperty = strDefault
Resume Next
Else
MsgBox “Error No: “ & err.Number _
& “; Description: “ & err.Description
Resume ErrorHandlerExit
End If

End Function

Part III Adding More Functionality to Office

Free download pdf