Change titlebar text in VB code

  • Thread starter Thread starter Max Moor
  • Start date Start date
M

Max Moor

Hi All,
The titlebar in Access shows the name of the active database. Is
there a way to change that?
My database tracks data for multiple events. I'd like to have the
titlebar show the database name and the name of the event currently loaded
within it.

- Max
 
I use this in a module to display the name of the current user in the
titlebar (NaamEngineer is a selfdefined function) I call it through the
autoexecmacro as ChangeTitle()

Function ChangeTitle()
Dim dbs As Database, prp As Propertybb
Const conPropNotFoundError = 3270

On Error GoTo ErrorHandler

Set dbs = CurrentDb

dbs.Properties!AppTitle = "Gebruiker is = " & NaamEngineer

Application.RefreshTitleBar
Exit Function

ErrorHandler:
If Err.Number = conPropNotFoundError Then
Set prp = dbs.CreateProperty("AppTitle", dbText, _
"Gebruiker = " & NaamEngineer)
dbs.Properties.Append prp
Else
MsgBox "Error: " & Err.Number & vbCrLf & Err.Description
End If
Resume Next
End Function
 
I use this in a module to display the name of the current user in the
titlebar (NaamEngineer is a selfdefined function) I call it through
the autoexecmacro as ChangeTitle()

Function ChangeTitle()
Dim dbs As Database, prp As Propertybb
Const conPropNotFoundError = 3270

On Error GoTo ErrorHandler

Set dbs = CurrentDb

dbs.Properties!AppTitle = "Gebruiker is = " & NaamEngineer

Application.RefreshTitleBar
Exit Function

ErrorHandler:
If Err.Number = conPropNotFoundError Then
Set prp = dbs.CreateProperty("AppTitle", dbText, _
"Gebruiker = " & NaamEngineer)
dbs.Properties.Append prp
Else
MsgBox "Error: " & Err.Number & vbCrLf & Err.Description
End If
Resume Next
End Function

Works great. Thanks.
 
Back
Top