ExtremeFitness
asked on
MS Access 2003 - Changing the Captiopn bar text.
How can I change the caption bar text in Ms access when my default Db is null as I am connected to sqlserver 2005??
ASKER
I need to set this at runtime not in the designer...
Give this a whirl.. (in DAO)
Dim db as Database
Set db = CurrentDb() 'Or however you are connecting into Access
db.Properties("AppTitle"). Value = "Your New Caption Goes Here"
Dim db as Database
Set db = CurrentDb() 'Or however you are connecting into Access
db.Properties("AppTitle").
ASKER
the file is an Access Project ADP and CurrentDb is currently set to nothing.
Hi ExtremeFitness,
> when my default Db is null
What does that mean?
When you start Access you are not connected to anything until you open a database (adp or mdb)
Pete
> when my default Db is null
What does that mean?
When you start Access you are not connected to anything until you open a database (adp or mdb)
Pete
ASKER
My database is linked to sql server the default db object tells me it is null...
There's always the nasty way.... Using the Win32API
'declare the following in a vb Module in that database
Private Declare Function SetWindowText Lib "user32" _
Alias "SetWindowTextA" (ByVal hwnd As Long, _
ByVal lpString As String) As Long
You can now call SetWindowText(handletoyour window,"My new Caption")
Of course to specify the window's handle, maybe the
application.hWndAccessApp will work for you.
If not, you can use the FindWindow api to find it (it returns a handle that you can use with SetWindowText)
Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" _
(ByVal lpClassName As String, ByVal lpWindowName As String) As Long
Hope this helps,
Shane
'declare the following in a vb Module in that database
Private Declare Function SetWindowText Lib "user32" _
Alias "SetWindowTextA" (ByVal hwnd As Long, _
ByVal lpString As String) As Long
You can now call SetWindowText(handletoyour
Of course to specify the window's handle, maybe the
application.hWndAccessApp will work for you.
If not, you can use the FindWindow api to find it (it returns a handle that you can use with SetWindowText)
Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" _
(ByVal lpClassName As String, ByVal lpWindowName As String) As Long
Hope this helps,
Shane
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
This worked great!! thanks :)
No probs... Thanks also to Jim though, for putting the call out.
The database itself will have a default of the file name, unless you have a value in Tools menu:Startup, Application Title
All forms will have a Caption property which is editable in Form Design.
All message boxes called via VBA code have a Title parameter which you can set.