Link to home
Start Free TrialLog in
Avatar of ExtremeFitness
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??

Avatar of Jim Horn
Jim Horn
Flag of United States of America image

Change the caption bar of what exactly?

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.
Avatar of ExtremeFitness
ExtremeFitness

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"
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
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(handletoyourwindow,"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
ASKER CERTIFIED SOLUTION
Avatar of Leigh Purvis
Leigh Purvis
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
This worked great!! thanks :)
No probs... Thanks also to Jim though, for putting the call out.