RefreshTitleBar Method Example

The following example sets the AppTitle property of the current database and applies the RefreshTitleBar method to update the title bar.

Sub ChangeTitle()
    Dim obj As Object
    Const conPropNotFoundError = 3270
    
    On Error GoTo ErrorHandler
    ' Return Database object variable pointing to
    ' the current database.
    Set dbs = CurrentDb
    ' Change title bar.
    dbs.Properties!AppTitle = "Contacts Database"
    ' Update title bar on screen.
    Application.RefreshTitleBar
    Exit Sub
    
ErrorHandler:
    If Err.Number = conPropNotFoundError Then
        Set obj = dbs.CreateProperty("AppTitle", dbText, "Contacts Database")
        dbs.Properties.Append obj
    Else
        MsgBox "Error: " & Err.Number & vbCrLf & Err.Description
    End If
    Resume Next
End Sub