Access 2007: How to tell which DB is open?

  • Thread starter Graham Wideman [Visio MVP]
  • Start date
G

Graham Wideman [Visio MVP]

Hi folks:

Where in the UI can I see the filename of the open database? This is
especially needed when I have multiple databases open. I was expecting it to
appear in the titlebar... and indeed the filename does show in the taskbar
blob, but it's diffiult to know which one is which.

Further, where do I see that full path of the open database?

Thanks,

Graham
 
A

Allen Browne

If you do not specify a custom application title, the file name appears in
the application title bar.

To show the full path, use:
=CurrentDb.Name

You may find this helpful:
http://allenbrowne.com/ser-53.html
The article provides code you can use to create a splash screen showing lots
of info about your current application.
 
G

Graham Wideman [Visio MVP]

Hi Allen,
If you do not specify a custom application title, the file name appears in
the application title bar.

Thanks for the reply but... I'm not talking about an application created
with Access and based on Forms, I'm just talking about running Access and
opening a database, no forms, just viewing tables, queries and so on. (FWIW,
in old-style multi-window MDI so-called "overlapping window" mode).

Graham
 
A

Allen Browne

I'm not sure I understood you.

When you open Access 2007, it opens in a window.
That window has a title bar across (like any Windows program does.)
That title bar contains the name of the file you have open.

If that's not what you see, click:
- Office Button (top left),
- Access Options (bottom of dialog),
- Current database (left of Access Options window),
and clear the box beside:
Application Title.
If you have a custom application title, you don't see the file name in the
application title bar.

If you want to know what folder the database is in without using code, go
to:
- Office Button
- Manage | Database Properties
and look on the General tab beside Location.

--
Allen Browne - Microsoft MVP. Perth, Western Australia

Reply to group, rather than allenbrowne at mvps dot org.

in message
 
G

Graham Wideman [Visio MVP]

Hi Allen:

Thanks for your patient explanation on this.
- Office Button > Manage | Database Properties

OK, that's one of the things I hadn't found, a big thanks for that.

Now, on the title bar situation. The scenario is no custom application
title. With your prompting, I now see that when initially opened, indeed the
database name appears in the title bar. However, as soon as I open a table,
the title bar caption disappears, and is replaced by just "Microsoft
Access", and overlapped by a "Table Tools" tabby-buttony thing.

Even if I close the table, ostensibly returning to the original state as on
opening, no database name shows in the title bar, and there's no clue
anywhere in the UI, short of looking at Database Properties, as to which
database I'm looking at.

Again prompted by your explanation, I see how *adding* an Application title
does cause a title to appear in the main window's title bar. So a
workaround would be for me to manually stick the filename into the
Application Title slot... but this is asking for trouble as different
snapshots of the database are made, etc. Maybe there's some automation I
could use to do that automatically on opening, and add that to the growing
list of items that need to be in a template... once again following the path
you spelled out on your excellent "how to stay sane with Access 2007" page.
:) But of course that would need to be added to our raft of existing
databases.

Anyhow, if you have managed to arrange for the database name to stay showing
in the titlebar by default, that would be good to hear about!

Graham
 
A

Allen Browne

I could give you a programmatic way to assign the database name (including
full path if you wish) as the appliction title, each time it starts up? But
perhaps you don't want to use any code?

You would need the SetPropertyDAO() from this link:
http://allenbrowne.com/AppPrintMgtCode.html#SetPropertyDAO
and then:
Call SetPropertyDAO(CurrentDb, "AppTitle", dbText,
CurrentProject.FullName)
RefreshTitleBar

Do this in a function called from your AutoExec macro (since you have no
startup form.)

If you want the file name without the path, use CurrentDb.Name instead of
CurrentProject.FullName.

--
Allen Browne - Microsoft MVP. Perth, Western Australia

Reply to group, rather than allenbrowne at mvps dot org.

in message
Hi Allen:

Thanks for your patient explanation on this.
- Office Button > Manage | Database Properties

OK, that's one of the things I hadn't found, a big thanks for that.

Now, on the title bar situation. The scenario is no custom application
title. With your prompting, I now see that when initially opened, indeed
the database name appears in the title bar. However, as soon as I open a
table, the title bar caption disappears, and is replaced by just
"Microsoft Access", and overlapped by a "Table Tools" tabby-buttony thing.

Even if I close the table, ostensibly returning to the original state as
on opening, no database name shows in the title bar, and there's no clue
anywhere in the UI, short of looking at Database Properties, as to which
database I'm looking at.

Again prompted by your explanation, I see how *adding* an Application
title does cause a title to appear in the main window's title bar. So a
workaround would be for me to manually stick the filename into the
Application Title slot... but this is asking for trouble as different
snapshots of the database are made, etc. Maybe there's some automation I
could use to do that automatically on opening, and add that to the growing
list of items that need to be in a template... once again following the
path you spelled out on your excellent "how to stay sane with Access 2007"
page. :) But of course that would need to be added to our raft of
existing databases.

Anyhow, if you have managed to arrange for the database name to stay
showing in the titlebar by default, that would be good to hear about!

Graham

Allen Browne said:
I'm not sure I understood you.

When you open Access 2007, it opens in a window.
That window has a title bar across (like any Windows program does.)
That title bar contains the name of the file you have open.

If that's not what you see, click:
- Office Button (top left),
- Access Options (bottom of dialog),
- Current database (left of Access Options window),
and clear the box beside:
Application Title.
If you have a custom application title, you don't see the file name in
the application title bar.

If you want to know what folder the database is in without using code, go
to:
- Office Button
- Manage | Database Properties
and look on the General tab beside Location.

"Graham Wideman [Visio MVP]" <[email protected]>
wrote in message
Hi Allen,

If you do not specify a custom application title, the file name appears
in the application title bar.

Thanks for the reply but... I'm not talking about an application created
with Access and based on Forms, I'm just talking about running Access
and opening a database, no forms, just viewing tables, queries and so
on. (FWIW, in old-style multi-window MDI so-called "overlapping window"
mode).
 
A

AG

I think you are referring to the fact that in prior versions of Access, the
filename was displayed in the titlebar of the database window.
Since 2007 has no database window, there is no filename displayed.
2007 added some nice features. Unfortunately, it also took away some
developer productivity features, like this one. I guess we just have to live
with it.
 
G

Graham Wideman [Visio MVP]

I could give you a programmatic way to assign the database name

Thanks Allen.... that's exactly where I was headed, but you handed it to me
on a platter. Thanks.

Graham

--
---------------------------------------------------
Graham Wideman
---------------------------------------------------
Book/Tools:
Visio 2003 Developer's Survival Pack
Resources for programmable diagramming at:
http://www.diagramantics.com
Allen Browne said:
I could give you a programmatic way to assign the database name (including
full path if you wish) as the appliction title, each time it starts up? But
perhaps you don't want to use any code?

You would need the SetPropertyDAO() from this link:
http://allenbrowne.com/AppPrintMgtCode.html#SetPropertyDAO
and then:
Call SetPropertyDAO(CurrentDb, "AppTitle", dbText,
CurrentProject.FullName)
RefreshTitleBar

Do this in a function called from your AutoExec macro (since you have no
startup form.)

If you want the file name without the path, use CurrentDb.Name instead of
CurrentProject.FullName.

--
Allen Browne - Microsoft MVP. Perth, Western Australia

Reply to group, rather than allenbrowne at mvps dot org.

in message
Hi Allen:

Thanks for your patient explanation on this.
- Office Button > Manage | Database Properties

OK, that's one of the things I hadn't found, a big thanks for that.

Now, on the title bar situation. The scenario is no custom application
title. With your prompting, I now see that when initially opened, indeed
the database name appears in the title bar. However, as soon as I open a
table, the title bar caption disappears, and is replaced by just
"Microsoft Access", and overlapped by a "Table Tools" tabby-buttony
thing.

Even if I close the table, ostensibly returning to the original state as
on opening, no database name shows in the title bar, and there's no clue
anywhere in the UI, short of looking at Database Properties, as to which
database I'm looking at.

Again prompted by your explanation, I see how *adding* an Application
title does cause a title to appear in the main window's title bar. So a
workaround would be for me to manually stick the filename into the
Application Title slot... but this is asking for trouble as different
snapshots of the database are made, etc. Maybe there's some automation I
could use to do that automatically on opening, and add that to the
growing list of items that need to be in a template... once again
following the path you spelled out on your excellent "how to stay sane
with Access 2007" page. :) But of course that would need to be added to
our raft of existing databases.

Anyhow, if you have managed to arrange for the database name to stay
showing in the titlebar by default, that would be good to hear about!

Graham

Allen Browne said:
I'm not sure I understood you.

When you open Access 2007, it opens in a window.
That window has a title bar across (like any Windows program does.)
That title bar contains the name of the file you have open.

If that's not what you see, click:
- Office Button (top left),
- Access Options (bottom of dialog),
- Current database (left of Access Options window),
and clear the box beside:
Application Title.
If you have a custom application title, you don't see the file name in
the application title bar.

If you want to know what folder the database is in without using code,
go to:
- Office Button
- Manage | Database Properties
and look on the General tab beside Location.

"Graham Wideman [Visio MVP]" <[email protected]>
wrote in message
Hi Allen,

If you do not specify a custom application title, the file name
appears in the application title bar.

Thanks for the reply but... I'm not talking about an application
created with Access and based on Forms, I'm just talking about running
Access and opening a database, no forms, just viewing tables, queries
and so on. (FWIW, in old-style multi-window MDI so-called "overlapping
window" mode).
 
A

Anders

Allen,

I'm new to Office 2007 and am having the same issue :(. I do like your idea
and understand it, but am not sure how AutoExec marcros are handled in
Access2007. I presume the solution is such that opening any Db will run the
macro and fix the Title bar's text property.

Where do I put the code and how do I control when it gets run?

Anders

Allen Browne said:
I could give you a programmatic way to assign the database name (including
full path if you wish) as the appliction title, each time it starts up? But
perhaps you don't want to use any code?

You would need the SetPropertyDAO() from this link:
http://allenbrowne.com/AppPrintMgtCode.html#SetPropertyDAO
and then:
Call SetPropertyDAO(CurrentDb, "AppTitle", dbText,
CurrentProject.FullName)
RefreshTitleBar

Do this in a function called from your AutoExec macro (since you have no
startup form.)

If you want the file name without the path, use CurrentDb.Name instead of
CurrentProject.FullName.

--
Allen Browne - Microsoft MVP. Perth, Western Australia

Reply to group, rather than allenbrowne at mvps dot org.

in message
Hi Allen:

Thanks for your patient explanation on this.
- Office Button > Manage | Database Properties

OK, that's one of the things I hadn't found, a big thanks for that.

Now, on the title bar situation. The scenario is no custom application
title. With your prompting, I now see that when initially opened, indeed
the database name appears in the title bar. However, as soon as I open a
table, the title bar caption disappears, and is replaced by just
"Microsoft Access", and overlapped by a "Table Tools" tabby-buttony thing.

Even if I close the table, ostensibly returning to the original state as
on opening, no database name shows in the title bar, and there's no clue
anywhere in the UI, short of looking at Database Properties, as to which
database I'm looking at.

Again prompted by your explanation, I see how *adding* an Application
title does cause a title to appear in the main window's title bar. So a
workaround would be for me to manually stick the filename into the
Application Title slot... but this is asking for trouble as different
snapshots of the database are made, etc. Maybe there's some automation I
could use to do that automatically on opening, and add that to the growing
list of items that need to be in a template... once again following the
path you spelled out on your excellent "how to stay sane with Access 2007"
page. :) But of course that would need to be added to our raft of
existing databases.

Anyhow, if you have managed to arrange for the database name to stay
showing in the titlebar by default, that would be good to hear about!

Graham

Allen Browne said:
I'm not sure I understood you.

When you open Access 2007, it opens in a window.
That window has a title bar across (like any Windows program does.)
That title bar contains the name of the file you have open.

If that's not what you see, click:
- Office Button (top left),
- Access Options (bottom of dialog),
- Current database (left of Access Options window),
and clear the box beside:
Application Title.
If you have a custom application title, you don't see the file name in
the application title bar.

If you want to know what folder the database is in without using code, go
to:
- Office Button
- Manage | Database Properties
and look on the General tab beside Location.

"Graham Wideman [Visio MVP]" <[email protected]>
wrote in message
Hi Allen,

If you do not specify a custom application title, the file name appears
in the application title bar.

Thanks for the reply but... I'm not talking about an application created
with Access and based on Forms, I'm just talking about running Access
and opening a database, no forms, just viewing tables, queries and so
on. (FWIW, in old-style multi-window MDI so-called "overlapping window"
mode).
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top