File location

Gismo

Registered User
Hi All,

My IT guy wants to change the location of my stored PDF files to a new location on the server.
i currently have all my records hard coded to the file location.
he created a new shared map drive for all but my records points to S:\ABC.PDF
how do I change to the new map without changing all my links in access?
he wants me to use "..\ABC.PDF" instead of "S:\ABC.PDF" meaning this could be saved anywhere on the server and access will find the file.
any ideas out there?
 

Ranman256

Registered User
correct , do not use drive letters.
use the server UNC path: \\server\folder\folder\

I keep it in a tConfig table, in case it has to change.
(from the programmers bible: do not hardcode)
 

Gasman

Enthusiastic Amateur
Just update the file path substitiuting S: for \\ServerName

Or tell him to make the share S: or you map the new share to S: if the DB is just for you.?

If he decided to move servers in a few weeks you'd be doing it anyway?
 

Gismo

Registered User
Thank you for the reply
i dont want to hard code the a specific server either.
where ever the folder is moved to, we will have a map to that location
how would i code the location to locate the file no matter on which server it is saved?
 

Gasman

Enthusiastic Amateur
Thank you for the reply
i dont want to hard code the a specific server either.
where ever the folder is moved to, we will have a map to that location
how would i code the location to locate the file no matter on which server it is saved?
Well I would say you would have to use a mapped drive.

I have done the reverse where I remapped to another folder for test purposes, then remapped back after testing to the live folder.

That will involve your IT guy though, by the sounds of it.?

However Ranman's idea holds great merit. Store the main path in the DB and then just have additional path in records. If it changes, it just needs a quick update in one place.?

Either way you will be updating something.

Good luck.
 
Last edited:

theDBguy

I’m here to help
Hi Gismo. Are we talking about a Hyperlink field for the stored location? Or is it just a plain text field?
 

Pat Hartman

Super Moderator
Typically I only store the file name rather than the entire path for each individual reference. I then store the path in a separate table to make it easy to change. If the path changes, the users just update the value in the "path" table. Then in the FollowHyperlink, I concatenate the path and the file name. Make sure that the path always ends with a "/" when you save it. Some applications might need different paths for different document types so your path table might need a single row or multiple rows. You can use dLookup() to get the path for "pictures" if that is the file type you want to open or get the path for "licenses" if that is the file type you want to open.
 

The_Doc_Man

Happy Retired Curmudgeon
From the description, specifically the suggestion to use "..\" as part of the path, your IT guy is suggesting a relative path. I am going out on a limb here by guessing the intent, but if the files are to be stored in the same directory as (or a sub-directory of) the back-end file, all you would have to do is store the file names and types because the file locations would be constants - either X:/path/path.../path/ or server\\path\path...\path.

Before preparing to use the referenced file, locate the BE file by looking at the .Connect string of any one of the tables linked from the BE. That connection string will include the fully qualified path that you are using at the moment to get to the file holding that table. It is a relatively easy process using InStrRev to find the last "\" of that specification and remove the BE name and type, leaving you with the full path to the BE file's folder.

So then if the files you want share the folder with the BE, you tack the name/type and device/path (or server/path) strings together and build the server, path, name, and type string dynamically. If there is a sub-folder and its name is constant, you simply add that constant string in the path when you concatenate the strings. Shouldn't be that tricky.

The ONLY thing you would then need to do in future moves is remap the FE to the BE once and redistribute it. As long as everything else was maintained, this should work.
 

Gismo

Registered User
Hi all,
i managed to get the linked file location changed.
i now just realized that all my linked tables are still pointing to the old mapped location.
i have 6 different DB's, pointing to 3 different back ends which now need to be changed to the new mapped drive, is there and easy way to change the mapped location of the linked tables with out using linked table manager where you need to remap each table one by one
 

gemma-the-husky

Super Moderator
@gismo

if you are having to do this a number of times, it points to having a generalised solution. The idea of storing the path in a settings folder, and just the file name in the data table is a good one, and would make any future similar change easy to accomplish.
 

Pat Hartman

Super Moderator
Thanks for the link Gasman. That tool has saved my bacon more than once. Using the old linked tables manager was a serious PITA when you had multiple BEs. It was way too easy to skip a table and leave it linked to the old source.
I think if you have a version of Access that includes the new linked tables manager, the problem may have been solved but I haven't really played with that version yet. I'll keep delivering my own form since it is easy for me to control and it is available even when using the Access runtime.
 
Top