Good to virtually meet up with you all again.
Here's an Access issue (bug ?) that I cannot seem to resolve. I have this code which is run by an autoexec macro :
Set dbs = CurrentDb
strTitle = dbs.Containers("Databases").Documents("UserDefined").Properties("ApplicationName")
strTitle = strTitle & " " & dbs.Containers("Databases").Documents("UserDefined").Properties("VersionNumber")
On Error Resume Next
dbs.Properties("Apptitle") = strTitle
If Err.Number = 3270 Then
Set prp = dbs.CreateProperty("AppTitle", "Text", strTitle)
dbs.Properties.Refresh
End If
Application.RefreshTitleBar
However, it does not change the title bar at all - and I do not know why.
Any thoughts ?
Bodders
RefreshTitleBar not working
-
- Administrator
- Posts: 78596
- Joined: 16 Jan 2010, 00:14
- Status: Microsoft MVP
- Location: Wageningen, The Netherlands
Re: RefreshTitleBar not working
Welcome to Eileen's Lounge!
Which version of Access are you using, and which database format? I tried your code in Access 2007, and after adding custom properties ApplicationName and VersionNumber, it worked flawlessly. (The database is in a trusted location, so macros run without prompting)
Which version of Access are you using, and which database format? I tried your code in Access 2007, and after adding custom properties ApplicationName and VersionNumber, it worked flawlessly. (The database is in a trusted location, so macros run without prompting)
Best wishes,
Hans
Hans
-
- NewLounger
- Posts: 5
- Joined: 10 Feb 2010, 16:13
Re: RefreshTitleBar not working
Access 2003 SP3
-
- Administrator
- Posts: 78596
- Joined: 16 Jan 2010, 00:14
- Status: Microsoft MVP
- Location: Wageningen, The Netherlands
-
- Administrator
- Posts: 78596
- Joined: 16 Jan 2010, 00:14
- Status: Microsoft MVP
- Location: Wageningen, The Netherlands
Re: RefreshTitleBar not working
I have tested your code in Access 2003, and it works OK there too. I have attached a sample database (Access 2000 format, zipped). If I open it, select File | Database Properties..., activate the Custom tab, change the values of ApplicationName and VersionNumber, then run the AutoExec macro or close and reopen the database, the caption of the Access application window is updated correctly. What happens if you try that?
You do not have the required permissions to view the files attached to this post.
Best wishes,
Hans
Hans
-
- NewLounger
- Posts: 5
- Joined: 10 Feb 2010, 16:13
Re: RefreshTitleBar not working
Hans
Thanks for your help, but it does not work on my PC. Having trawled through some old code, I found an API call which does work :
Public Declare Function SetWindowText Lib "user32" _
Alias "SetWindowTextA" (ByVal hWnd As Long, ByVal lpString As String) As Long
Call SetWindowText(Application.hWndAccessApp, strTitle)
No idea why this does work & VBA version does not.
Bodders
Thanks for your help, but it does not work on my PC. Having trawled through some old code, I found an API call which does work :
Public Declare Function SetWindowText Lib "user32" _
Alias "SetWindowTextA" (ByVal hWnd As Long, ByVal lpString As String) As Long
Call SetWindowText(Application.hWndAccessApp, strTitle)
No idea why this does work & VBA version does not.
Bodders
-
- Administrator
- Posts: 78596
- Joined: 16 Jan 2010, 00:14
- Status: Microsoft MVP
- Location: Wageningen, The Netherlands
Re: RefreshTitleBar not working
Does the macro work if you run it manually, from the database window?
Best wishes,
Hans
Hans
-
- NewLounger
- Posts: 5
- Joined: 10 Feb 2010, 16:13
Re: RefreshTitleBar not working
Hans - no it does not. The only thing I can suggest is that we cannot make registry changes on our work PC's - would that have an impact ?
-
- Administrator
- Posts: 78596
- Joined: 16 Jan 2010, 00:14
- Status: Microsoft MVP
- Location: Wageningen, The Netherlands
Re: RefreshTitleBar not working
I don't think so - the code does not write to the registry.
I'm afraid I don't knoiw why it doesn't work, but fortunately you have found a workaround.
I'm afraid I don't knoiw why it doesn't work, but fortunately you have found a workaround.
Best wishes,
Hans
Hans
-
- 4StarLounger
- Posts: 482
- Joined: 24 Jan 2010, 15:02
- Location: Colorado, USA
Re: RefreshTitleBar not working
Have you tried setting the Title Bar using the Start-Up parameters - unless we change the title dynamically while the application is in use, we use that approach.Bodders wrote:Hans - no it does not. The only thing I can suggest is that we cannot make registry changes on our work PC's - would that have an impact ?
Wendell
You can't see the view if you don't climb the mountain!
You can't see the view if you don't climb the mountain!
-
- NewLounger
- Posts: 5
- Joined: 10 Feb 2010, 16:13
Re: RefreshTitleBar not working
Wendell
That does work, but I wanted to do the whole thing programmatically if I could. The API call sorts it out anyway.
That does work, but I wanted to do the whole thing programmatically if I could. The API call sorts it out anyway.