Setting a title?

Nirious

Registered User.
Local time
Today, 18:33
Joined
Jul 31, 2004
Messages
106
I know that you can change the title of your application in the startup options in Access.

But can it also be done by vba code at runtime?
 
Straight from Access VBA Help
______________________________

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
 

Users who are viewing this thread

Back
Top Bottom