in message:
is there a way to set the Application Title (the one you normally set in
Startup) via VBA in Access 2003?
Hi Patrick,
Place these functions in a new standard module, compile, and save:
'********Code Start*******
Public Function SetApplicationTitle(ByVal MyTitle As String)
On Error GoTo ErrorPoint
If SetStartupProperty("AppTitle", dbText, MyTitle) Then
Application.RefreshTitleBar
Else
MsgBox "ERROR: Could not set Application Title"
End If
ExitPoint:
Exit Function
ErrorPoint:
MsgBox "The following error has occurred:" _
& vbNewLine & "Error Number: " & Err.Number _
& vbNewLine & "Error Description: " & Err.Description _
, vbExclamation, "Unexpected Error"
Resume ExitPoint
End Function
Public Function SetStartupProperty(prpName As String, _
prpType As Variant, prpValue As Variant) As Integer
On Error GoTo ErrorPoint
Dim db As DAO.Database
Dim prp As DAO.Property
Const ERROR_PROPNOTFOUND = 3270
Set db = CurrentDb()
' Set the startup property value.
db.Properties(prpName) = prpValue
SetStartupProperty = True
ExitPoint:
' Cleanup code
On Error Resume Next
Set db = Nothing
Exit Function
ErrorPoint:
Select Case Err
' If the property does not exist, create it and try again.
Case ERROR_PROPNOTFOUND
Set prp = db.CreateProperty(prpName, prpType, prpValue)
db.Properties.Append prp
Resume
Case Else
SetStartupProperty = False
Resume ExitPoint
End Select
End Function
'********Code End*******
(Make sure you have a reference to the DAO object library)
From code to change the title you would just do this:
SetApplicationTitle("New Title Here")
Hope that helps,