Change titlebar text in VB code

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
 
H

Henro

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
 
M

Max Moor

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top