refering to a file

A

Audrey

Hi,

I'm trying to refer to a file name from my database to
open an external file.

Right now, I have to enter the full path
(C:\folder\filename.ext)

Both files will be in the same folder, but I don't know
what folder they will be placed in later on, and they
might be moved a few times.

Is there a way to find from code the current path of a
database and use this path to concatenate to the filename
of the external file?

Thanks for the help.
 
G

Gurtz

Yes, I would also like this question answered.. I tried to
refer to "\images\filename," since the images directory is
in the same directory as the database. But this doesn't
work .. and ".\" is no help either.

Thanks to anyone who has an answer for this,
Gurtz
[email = no $]
 
A

Audrey

shucks...

I'm stuck with 97 :-( And I'm not good enough to hard-code
the thing.

Thanks for the tip though.
 
D

Dirk Goldgar

Audrey said:
shucks...

I'm stuck with 97 :-( And I'm not good enough to hard-code
the thing.

Oh, you can get it with Access 97. It's just a bit more complicated.
Here's what you do:

Dim strDBFolder As String

strDBFolder = CurrentDb.Name
strDBFolder = Left(strDBFolder, Len(strDBFolder) -
Len(Dir(strDBFolder)))

That gives you the folder path *with* the trailing backslash, unlike
CurrentProject.Path.
 

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