Application title bar

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I would like to use the title bar to display information from the DB. Can
anyone tell me of the command to write something to the bar.

Paul
 
If you want a single text to use, you can set this property in the Tools |
Startup | Application Title box.

If you want to change it programmatically, then you must run code that
checks to see if the property exists (it's one of those that doesn't exist
until you create it) and then set it.

Here are two subroutines that I use to set and clear the application's title
caption property:


Private Sub ClearTheApplicationTitleText()
Dim dbs As DAO.Database
Dim strCurrentAppTitle As String, strTry As String
On Error Resume Next
Set dbs = CurrentDb
strCurrentAppTitle = "KenTestDB"
With dbs.Containers!Databases.Documents!MSysDb
strTry = .Properties("AppTitle")
If Err.Number <> 3270 Then
.Properties.Delete "AppTitle"
End If
RefreshTitleBar
End With
dbs.Close
Set dbs = Nothing
End Sub


Private Sub SetTheApplicationTitleText(Optional blnBaseTitleOnly As Boolean
= True)
Dim dbs As DAO.Database
Dim prp As DAO.Property
Dim strTitleAddition As String, strCurrentAppTitle As String, strTry As
String
On Error Resume Next
Set dbs = CurrentDb
strCurrentAppTitle = "KenTestDB"
strTitleAddition = ""
If blnBaseTitleOnly = False Then strTitleAddition = Nz(Me.Text0.Value, "")
With dbs.Containers!Databases.Documents!MSysDb
strTry = .Properties("AppTitle")
If Err.Number = 3270 Then
Set prp = .CreateProperty("AppTitle", dbText, strCurrentAppTitle)
.Properties.Append prp
Set prp = Nothing
End If
.Properties("AppTitle") = strCurrentAppTitle & IIf(Len(strTitleAddition)
0, " < " & strTitleAddition & " >", "")
RefreshTitleBar
End With
dbs.Close
Set dbs = Nothing
End Sub
 
Thank you

Paul

Ken Snell said:
If you want a single text to use, you can set this property in the Tools |
Startup | Application Title box.

If you want to change it programmatically, then you must run code that
checks to see if the property exists (it's one of those that doesn't exist
until you create it) and then set it.

Here are two subroutines that I use to set and clear the application's title
caption property:


Private Sub ClearTheApplicationTitleText()
Dim dbs As DAO.Database
Dim strCurrentAppTitle As String, strTry As String
On Error Resume Next
Set dbs = CurrentDb
strCurrentAppTitle = "KenTestDB"
With dbs.Containers!Databases.Documents!MSysDb
strTry = .Properties("AppTitle")
If Err.Number <> 3270 Then
.Properties.Delete "AppTitle"
End If
RefreshTitleBar
End With
dbs.Close
Set dbs = Nothing
End Sub


Private Sub SetTheApplicationTitleText(Optional blnBaseTitleOnly As Boolean
= True)
Dim dbs As DAO.Database
Dim prp As DAO.Property
Dim strTitleAddition As String, strCurrentAppTitle As String, strTry As
String
On Error Resume Next
Set dbs = CurrentDb
strCurrentAppTitle = "KenTestDB"
strTitleAddition = ""
If blnBaseTitleOnly = False Then strTitleAddition = Nz(Me.Text0.Value, "")
With dbs.Containers!Databases.Documents!MSysDb
strTry = .Properties("AppTitle")
If Err.Number = 3270 Then
Set prp = .CreateProperty("AppTitle", dbText, strCurrentAppTitle)
.Properties.Append prp
Set prp = Nothing
End If
.Properties("AppTitle") = strCurrentAppTitle & IIf(Len(strTitleAddition)
RefreshTitleBar
End With
dbs.Close
Set dbs = Nothing
End Sub
 
Back
Top