J
Jeff Conrad
Place these functions in a new standard module, compile, and save:
' Code Start
Public Function SetApplicationTitle(ByVal MyTitle As String)
If SetStartupProperty("AppTitle", dbText, MyTitle) Then
Application.RefreshTitleBar
Else
MsgBox "ERROR: Could not set Application Title"
End If
End Function
Public Function SetStartupProperty(prpName As String, _
prpType As Variant, prpValue As Variant) As Integer
Dim db As DAO.Database, prp As DAO.Property, ws As DAO.Workspace
Const ERROR_PROPNOTFOUND = 3270
Set db = CurrentDb()
' Set the startup property value.
On Error GoTo Err_SetStartupProperty
db.Properties(prpName) = prpValue
SetStartupProperty = True
Bye_SetStartupProperty:
Exit Function
Err_SetStartupProperty:
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 Bye_SetStartupProperty
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")
--
Jeff Conrad
Access Junkie - MVP
http://home.bendbroadband.com/conradsystems/accessjunkie.html
http://www.access.qbuilt.com/html/articles.html
in message:
news:[email protected]...
' Code Start
Public Function SetApplicationTitle(ByVal MyTitle As String)
If SetStartupProperty("AppTitle", dbText, MyTitle) Then
Application.RefreshTitleBar
Else
MsgBox "ERROR: Could not set Application Title"
End If
End Function
Public Function SetStartupProperty(prpName As String, _
prpType As Variant, prpValue As Variant) As Integer
Dim db As DAO.Database, prp As DAO.Property, ws As DAO.Workspace
Const ERROR_PROPNOTFOUND = 3270
Set db = CurrentDb()
' Set the startup property value.
On Error GoTo Err_SetStartupProperty
db.Properties(prpName) = prpValue
SetStartupProperty = True
Bye_SetStartupProperty:
Exit Function
Err_SetStartupProperty:
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 Bye_SetStartupProperty
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")
--
Jeff Conrad
Access Junkie - MVP
http://home.bendbroadband.com/conradsystems/accessjunkie.html
http://www.access.qbuilt.com/html/articles.html
in message:
news:[email protected]...