Application Title Bar

J

JimS

I know you can set the application title in the Startup dialog box, but I'd
like to do it programatically using VBA in my Startup form. Anybody know how?
 
B

bnkari via AccessMonster.com

This is code from one of my applications. Straight from Access Help. You
can enter this directly into a module. Pass the variable (in this case
'PilotName') and it should update your title bar. You can obviously edit the
code to suit your needs. Hope this helps, and let me know if you have any
questions.




Sub ChangeTitle(PilotName As String)
Dim obj As Object
Dim dbs As DAO.Database
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 = PilotName & " Pilot Log Book"
' Update title bar on screen.
Application.RefreshTitleBar
Exit Sub

ErrorHandler:
If Err.Number = conPropNotFoundError Then
Set obj = dbs.CreateProperty("AppTitle", dbText, PilotName & " Pilot
Log Book")
dbs.Properties.Append obj
Else
MsgBox "Error: " & Err.Number & vbCrLf & Err.Description
End If
Resume Next
End Sub
 

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