Hi,
I am trying to use some Access 2000 code to change the access application title, but whenever I run the code I get an "Error 91 Object variable or With block variable not set" error message on the DB.Properties(prpName) = prpValue statement, does anyone have any ideas what I am doing wrong, I have checked the DAO is referenced in this database.
Thanks,
Gavin,
I am trying to use some Access 2000 code to change the access application title, but whenever I run the code I get an "Error 91 Object variable or With block variable not set" error message on the DB.Properties(prpName) = prpValue statement, does anyone have any ideas what I am doing wrong, I have checked the DAO is referenced in this database.
Code:
Function SetApplicationTitle(ByVal MyTitle As String)
If SetStartupProperty("AppTitle", dbText, MyTitle) Then
Application.RefreshTitleBar
Else
MsgBox "ERROR: Could not set Application Title"
End If
End Function
Function SetStartupProperty(prpName As String, _
prpType As Variant, prpValue As Variant) As Integer
Dim DB As DAO.DATABASE
Dim PRP As DAO.Property
Dim WS As DAO.Workspace
Const ERROR_PROPNOTFOUND = 3270
Set DB = CurrentDb()
' Set the startup property value.
On Error GoTo Err_SetStartupProperty
DB.Properties(prpName) = prpValue
SetStartupProperty = True
Bye_SetStartupProperty:
Exit Function
Err_SetStartupProperty:
Select Case Err
' If the property does not exist, create it and try again.
Case ERROR_PROPNOTFOUND
Set PRP = DB.CreateProperty(prpName, prpType, prpValue)
DB.Properties.Append PRP
Resume
Case Else
Debug.Print Err.Number & vbCrLf & Err.Description
SetStartupProperty = False
Resume Bye_SetStartupProperty
End Select
End Function
Thanks,
Gavin,