Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

CurrentDb.Properties refreshing in current session 1

Status
Not open for further replies.

zevw

MIS
Jul 3, 2001
697
US
Hi!

You can set the value of the application Title and Icon which is usually set in the Tools ====> Startup, with the following code

Code:
CurrentDb.Properties("AppTitle").Value = "My Program"
CurrentDb.Properties("AppIcon").Value = "C:\MyProg.ico"

I was wondering if these values can only be set for the next session,or can I run some code which will immediately refresh the title and icon.

i.e.
if the user decides to call their progran the company name rather than "My Program" and they want to see it on the Application Title (caption) now, how can that be done?

Thanks in advance
 
How are ya zevw . . . . .

[purple]Try this . . . should work:[/purple]
Code:
[blue]Public Sub SetAppTitleBar(txtTitle As String, IconPath As String)
   Dim db As DAO.Database, prp As DAO.Property
   Dim prpName As String, prpText As String, Idx As Integer

On Error GoTo GotErr
   Set db = CurrentDb
   
   Idx = 1
   prpName = "AppTitle"
   db.Properties(prpName) = txtTitle [green]'Attempt to assign[/green]
   
   Idx = 2
   prpName = "AppIcon"
   db.Properties(prpName) = IconPath [green]'Attempt to assign[/green]
   
   Application.RefreshTitleBar [green]'Update On Screen![/green]

Exit Sub

GotErr:
   If Err.Number = 3270 Then [green]'property doesn't exist![/green]
      prpText = Choose(Idx, txtTitle, IconPath)
      Set prp = db.CreateProperty(prpName, dbText, prpText)
      db.Properties.Append prp [green]'New property set![/green]
   Else
      MsgBox "Error: " & Err.Number & vbCrLf & Err.Description
   End If
   Resume Next
End Sub[/blue]
Typical call to the routine would be:
Code:
[blue]   SetAppTitleBar("[purple][b]TitleBarText[/b][/purple]","[purple][b]Icon Path & FileName[/b][/purple]")[/blue]
[blue]Cheers! . . .[/blue]

Calvin.gif
See Ya! . . . . . .
 
Hi TheAceMan1:

Thanks, for your help.

It works great!!!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top