Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
Function GetOrSetProperty(ByVal strPropName As String, _
Optional ByVal strVal As String, _
Optional ByVal blnDebug As Boolean) As String
On Error GoTo ErrHandler
Dim dbs As DAO.Database
Dim cnt As DAO.Container
Dim doc As DAO.Document
Dim prp As DAO.Property
' Property not found error.
Const conPropertyNotFound = 3270
Set dbs = CurrentDb
Set cnt = dbs.Containers!Databases
Set doc = cnt.Documents!UserDefined
doc.Properties.Refresh
If Len(strVal) > 0 Then
doc.Properties(strPropName) = strVal
End If
GetOrSetProperty = doc.Properties(strPropName)
If blnDebug Then
For Each prp In doc.Properties
Debug.Print prp.Name, prp.Value
Next prp
End If
ExitHere:
Exit Function
ErrHandler:
If Err = conPropertyNotFound Then
If Len(strVal) > 0 Then
Set prp = doc.CreateProperty(strPropName, DAO.dbText, strVal)
' Append to collection.
doc.Properties.Append prp
Resume
Else
Resume Next
End If
Else
' Unknown error.
MsgBox "Error in GetOrSetProperty() -" & Err & ":" & Err.Description
Resume ExitHere
End If
End Function