Need help with relative file paths

webeauty

Registered User.
Local time
Yesterday, 23:33
Joined
Aug 12, 2002
Messages
13
I have written a database that creates a photo directory of people for our church. Right now each record points to a photo that is kept in the same folder as the .mdb file. This folder gets passed on from person to person as time goes on. Instead of having to make them use a set file path, I wonder if there is a way to reference the pictures with a relative filepath like in a web page so it will automatically just point to the same folder that the .mdb file is in (instead of a fixed file path).

Any ideas?
Thanks!:confused:
 
If you are in an environment that has a server or at the very leas a workstation with an available share you can do so. The syntax would look something like this:

\\ServerName\ShareName\FolderName
 
Would this not still be a fixed file path though? We do not have a common server or share available for these users. I want them to be able to pass the folder on to any computer without having to put it in a certain place for it to work.
 
Gotcha I misunderstood exactly what you wanted to do the first time. Hopefuly someone will come up with an idea on this soon but in the meantime I will see if I can dig up something for you over the weekend.
 
When dealing with the location where your database is located, you can use the VBA construct

currentdb.name

which will give you the fully qualified file specification (node, device, path, name, type) of your database.

This name will include a DRIVE LETTER as opposed to the actual node name of the system hosting the file.

Unfortunately, this is only available to VBA code so you can't use it in queries without cheating.

In any case, if you want to know the directory in which your database resides, take the string above. Then find its length. Then starting FROM THE REAR, stop at the first slash you encounter. Everything from the first character to that rear slash (inclusive) is the fully qualified device and path.
 
BurkHix,
Thanks. I would much appreciate it!

Doc_Man...
My problem is not finding out where my database resides, it is being able to move the database file and pictures to any filepath and still have it work as long as they are in the same folder. Therefore, using a relative filepath (i.e. relative to the database, the pictures are in the same folder).

Does that make sense? Thanks for your input!
 

Users who are viewing this thread

Back
Top Bottom