Database path

  • Thread starter Richard Williams
  • Start date
R

Richard Williams

In VBA code in Access2000 I am able to use CurrentProject.Path to refer to
the path where my front-end database is located. Is there any way that I can
obtain the path of file in Access 97? Thank you for your assistance.
 
A

Albert D.Kallal

You have to parse it out.

You can use currentdb.Name.

The above gives the full pathname, and the name of the database also.

So, normally, we could use

dim str as string
str = CurrentDb.Name

str = Left(str, InStrRev(str, "\"))
Debug.Print str

However, access97 does not have the InStrRev function either!!

So, you can use:


str = CurrentDb.Name

str = Left(str, Len(str) - Len(Dir(str)))
Debug.Print str
 
R

Richard Williams

Albert D.Kallal said:
You have to parse it out.

You can use currentdb.Name.

The above gives the full pathname, and the name of the database also.

So, normally, we could use

dim str as string
str = CurrentDb.Name

str = Left(str, InStrRev(str, "\"))
Debug.Print str

However, access97 does not have the InStrRev function either!!

So, you can use:


str = CurrentDb.Name

str = Left(str, Len(str) - Len(Dir(str)))
Debug.Print str


--
Albert D. Kallal (Access MVP)
Edmonton, Alberta Canada
[email protected]
http://www.members.shaw.ca/AlbertKallal
Hi Albert
Thank you very much for your prompt reply. That's exactly the solution I was
looking for.
Regards
Richard Williams
 
Top