By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,647 Members | 1,433 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,647 IT Pros & Developers. It's quick & easy.

Getting the name of the database, is there a varialbe?

P: n/a
I want to display the name of the current database on a report. For
example, if the database is "db1.mdb", I want it to say "db1.mdb" somewhere
on the report. I could put a label with the value "db1.mdb" in it on the
report, but if the database were copied to another name, that label would be
incorrect.

Robert
Nov 13 '05 #1
Share this Question
Share on Google+
7 Replies


P: n/a
Try this

right(currentdb.Name,Len(currentdb.name) -instrrev(currentdb.Name,"\"))

CurrentDb.name is the full path of your database. We then start searching
from the end backwards to find the first occurrence of a "\"

Phil
"Robert" <pr**********@yahoo.com> wrote in message
news:fP*******************@fe06.lga...
I want to display the name of the current database on a report. For
example, if the database is "db1.mdb", I want it to say "db1.mdb" somewhere
on the report. I could put a label with the value "db1.mdb" in it on the
report, but if the database were copied to another name, that label would
be incorrect.

Robert

Nov 13 '05 #2

P: n/a
Another possibility:
=CurrentProject.Name

--
Allen Browne - Microsoft MVP. Perth, Western Australia.
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

"Phil Stanton" <di********@stantonfamily.co.uk> wrote in message
news:41*********************@mercury.nildram.net.. .
Try this

right(currentdb.Name,Len(currentdb.name) -instrrev(currentdb.Name,"\"))

CurrentDb.name is the full path of your database. We then start searching
from the end backwards to find the first occurrence of a "\"

Phil
"Robert" <pr**********@yahoo.com> wrote in message
news:fP*******************@fe06.lga...
I want to display the name of the current database on a report. For
example, if the database is "db1.mdb", I want it to say "db1.mdb"
somewhere on the report. I could put a label with the value "db1.mdb" in
it on the report, but if the database were copied to another name, that
label would be incorrect.

Nov 13 '05 #3

P: n/a
Or mid(currentdb.Name, instrrev(currentdb.Name,"\") + 1)

"Phil Stanton" <di********@stantonfamily.co.uk> wrote in message
news:41*********************@mercury.nildram.net.. .
Try this

right(currentdb.Name,Len(currentdb.name) -instrrev(currentdb.Name,"\"))

CurrentDb.name is the full path of your database. We then start searching
from the end backwards to find the first occurrence of a "\"

Phil
"Robert" <pr**********@yahoo.com> wrote in message
news:fP*******************@fe06.lga...
I want to display the name of the current database on a report. For
example, if the database is "db1.mdb", I want it to say "db1.mdb"
somewhere on the report. I could put a label with the value "db1.mdb" in
it on the report, but if the database were copied to another name, that
label would be incorrect.

Robert


Nov 13 '05 #4

P: n/a
Thanks
"Phil Stanton" <di********@stantonfamily.co.uk> wrote in message
news:41*********************@mercury.nildram.net.. .
Try this

right(currentdb.Name,Len(currentdb.name) -instrrev(currentdb.Name,"\"))

CurrentDb.name is the full path of your database. We then start searching
from the end backwards to find the first occurrence of a "\"

Phil
"Robert" <pr**********@yahoo.com> wrote in message
news:fP*******************@fe06.lga...
I want to display the name of the current database on a report. For
example, if the database is "db1.mdb", I want it to say "db1.mdb"
somewhere on the report. I could put a label with the value "db1.mdb" in
it on the report, but if the database were copied to another name, that
label would be incorrect.

Robert


Nov 13 '05 #5

P: n/a
Thanks
"Allen Browne" <Al*********@SeeSig.Invalid> wrote in message
news:41**********************@per-qv1-newsreader-01.iinet.net.au...
Another possibility:
=CurrentProject.Name

--
Allen Browne - Microsoft MVP. Perth, Western Australia.
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

"Phil Stanton" <di********@stantonfamily.co.uk> wrote in message
news:41*********************@mercury.nildram.net.. .
Try this

right(currentdb.Name,Len(currentdb.name) -instrrev(currentdb.Name,"\"))

CurrentDb.name is the full path of your database. We then start searching
from the end backwards to find the first occurrence of a "\"

Phil
"Robert" <pr**********@yahoo.com> wrote in message
news:fP*******************@fe06.lga...
I want to display the name of the current database on a report. For
example, if the database is "db1.mdb", I want it to say "db1.mdb"
somewhere on the report. I could put a label with the value "db1.mdb" in
it on the report, but if the database were copied to another name, that
label would be incorrect.


Nov 13 '05 #6

P: n/a
Thanks
"Neil Ginsberg" <nr*@nrgconsult.com> wrote in message
news:Sk******************@newsread3.news.pas.earth link.net...
Or mid(currentdb.Name, instrrev(currentdb.Name,"\") + 1)

"Phil Stanton" <di********@stantonfamily.co.uk> wrote in message
news:41*********************@mercury.nildram.net.. .
Try this

right(currentdb.Name,Len(currentdb.name) -instrrev(currentdb.Name,"\"))

CurrentDb.name is the full path of your database. We then start searching
from the end backwards to find the first occurrence of a "\"

Phil
"Robert" <pr**********@yahoo.com> wrote in message
news:fP*******************@fe06.lga...
I want to display the name of the current database on a report. For
example, if the database is "db1.mdb", I want it to say "db1.mdb"
somewhere on the report. I could put a label with the value "db1.mdb" in
it on the report, but if the database were copied to another name, that
label would be incorrect.

Robert



Nov 13 '05 #7

P: n/a

"Robert" <pr**********@yahoo.com> wrote in message
news:fP*******************@fe06.lga...
I want to display the name of the current database on a report. For
example, if the database is "db1.mdb", I want it to say "db1.mdb" somewhere
on the report. I could put a label with the value "db1.mdb" in it on the
report, but if the database were copied to another name, that label would
be incorrect.

Robert

Nov 13 '05 #8

This discussion thread is closed

Replies have been disabled for this discussion.