When the file path location changes?? (1 Viewer)

MoxieCraz

Registered User.
Local time
Today, 18:02
Joined
Jun 8, 2010
Messages
29
I currently have a db that will store the file path in a table field named "FilePath." IF the file is moved the link obviously does not point to the file. IS there a way to have the "FilePath" field auto update itself if the file is moved to another location? This would eliminate having to go in and finding the new file path.

Background:
The idea is that once a file is no longer the current file, to move it to a new location on the drive; however, they still want to be able to link to the new file for reference purposes.

Your help and suggestions are greatly appreciated!
 

boblarson

Smeghead
Local time
Today, 15:02
Joined
Jan 12, 2001
Messages
32,059
Why use a table? You can get the file path by using

CurrentProject.Path

and with the name of the db -

CurrentProject.FullName
 

MoxieCraz

Registered User.
Local time
Today, 18:02
Joined
Jun 8, 2010
Messages
29
I was using the table to store the path name. The db is created to track all marketing elements, assets and placements. For each element, asset, and placement there is a unique file associated with it.
I am intrigued to how to implement your suggest. Please elaborate. thanks.
 

MoxieCraz

Registered User.
Local time
Today, 18:02
Joined
Jun 8, 2010
Messages
29
to clarify...the file path is of a jpg, pdf, etc. related to the record information - not the database filepath. :)
 

MoxieCraz

Registered User.
Local time
Today, 18:02
Joined
Jun 8, 2010
Messages
29
My thinking would be similar to a shortcut...if I move the file that the shortcut is associated with I don't have to recreate the link, the shortcut just follows the file to its new location.
 

ghudson

Registered User.
Local time
Today, 18:02
Joined
Jun 8, 2002
Messages
6,194
How would the database know where the file was moved too?
 

MoxieCraz

Registered User.
Local time
Today, 18:02
Joined
Jun 8, 2010
Messages
29
yes...that is my question.

Is there a way that when the file is moved that the db would follow the file to the new location and store the new path. Basically, when the file is moved I don't want it to loose the association to that file and am trying to avoid having to go in and manually find the file location again...could have someone move the file without me knowing that I need to manually find the new location within access.
 

boblarson

Smeghead
Local time
Today, 15:02
Joined
Jan 12, 2001
Messages
32,059
There isn't a way to do that. I thought you meant you were storing the database path and that is easily determined from code. Any other objects, if they were moved, would have to be manually fixed. Sorry.
 

MoxieCraz

Registered User.
Local time
Today, 18:02
Joined
Jun 8, 2010
Messages
29
Sadly, that is what I thought would be the response. :(

Thank you for your help!
 

vbaInet

AWF VIP
Local time
Today, 23:02
Joined
Jan 22, 2010
Messages
26,374
This is relative to performing a File Search in Windows when you don't know or can't remember where it's saved. I'm sure you know how long this can take.

To eliminate the need of finding paths have it pointing to a specific folder instead and let the users deal with moved files.
 

MoxieCraz

Registered User.
Local time
Today, 18:02
Joined
Jun 8, 2010
Messages
29
Thank you for the suggestion; unfortunately, in this case, each record must have an associated file, not just a folder. There is a button on the form, that when clicked, will open the file. IF the file is moved on the drive, the group using the database would only know that the file is no longer in the same location when they click on the button and try to open it from the original location. Because they are not the ones that moved the file on the drive, it can cause a lot of searching of files (or tracking down who moved the file) etc... You can see how this can be a frustrating and time waisting. It would be nice to just say "Don't move the files!" But reality is...they'll get moved. I am trying to avoid that frustration. I was thinking that there would be something similar to how a shortcut works with a target. If the file that the shortcut is targeting is moved, the link is not broken.
 

boblarson

Smeghead
Local time
Today, 15:02
Joined
Jan 12, 2001
Messages
32,059
Unfortunately you cannot code for every single thing someone may do to screw things up. Ultimately it probably has to come down from management to people saying "don't move the files, or it will mess something up and you will be held responsible." Then people might get the picture, but if you just say it then yes it will likely happen anyway.
 

DCrake

Remembered
Local time
Today, 23:02
Joined
Jun 8, 2005
Messages
8,626
Here is a little demo of user interface that allows for changing and refreshing links. See the documentation first.
 

Attachments

  • RefreshLinks.zip
    48.4 KB · Views: 131

boblarson

Smeghead
Local time
Today, 15:02
Joined
Jan 12, 2001
Messages
32,059
Here is a little demo of user interface that allows for changing and refreshing links. See the documentation first.
David, I think you misunderstood the same way I did. It isn't about linked tables or anything. It is about data stored in a table regarding PATHS for ITEMS like jpegs, pdfs, etc.
 

vbaInet

AWF VIP
Local time
Today, 23:02
Joined
Jan 22, 2010
Messages
26,374
Unfortunately you cannot code for every single thing someone may do to screw things up. Ultimately it probably has to come down from management to people saying "don't move the files, or it will mess something up and you will be held responsible." Then people might get the picture, but if you just say it then yes it will likely happen anyway.
And to this forward, you could record the username of the last person that successfully opened the file via the database. Although, they may not be the culprit, but it narrows things down a bit.
 

Users who are viewing this thread

Top Bottom