Universal Path to Form Images Folder (1 Viewer)

vdanelia

Registered User.
Local time
Today, 11:36
Joined
Jan 29, 2011
Messages
215
Hello Friends
I have a question and could not find an answer for this. I have an 'images' folder in my Project folder (For Example D:\DB\IMG)
DB is the folder where My access project file is and IMG is the folder where all the Access design images and icons are stored. Everything is OK No problem, But if I move folder to another place I have to correct all the Images path. Is there any universal way of linking the Images so that if I move folder from one place to another not affected (Like: ../IMG by using trails not the full path of images)
Thank you in Advanced
 

vbaInet

AWF VIP
Local time
Today, 19:36
Joined
Jan 22, 2010
Messages
26,374
Universal tracking of your folders?? Nope! It should be part of your Change plan to update the paths ;)

If you want to make your life easier store the path to the folder separately from the file name. So that all you need to do is change the path to the folder (which can be stored as a single record).
 

vdanelia

Registered User.
Local time
Today, 11:36
Joined
Jan 29, 2011
Messages
215
Thanks vbaInet, For the suggestion
 

vbaInet

AWF VIP
Local time
Today, 19:36
Joined
Jan 22, 2010
Messages
26,374
It can be done more easily if you were in a Networked environment and knew some batch scripting but that's more complex. This is how it's done in an enterprise architecture where you run a script everytime the user logs in to map the drives and relink missing paths.

You're welcome!
 

vbaInet

AWF VIP
Local time
Today, 19:36
Joined
Jan 22, 2010
Messages
26,374
Then speak to your SysAdmins and see if they can do something for you.
 

vdanelia

Registered User.
Local time
Today, 11:36
Joined
Jan 29, 2011
Messages
215
I did it Works Perfectly
vbaInet I'm SysAdmin My main field is Networking and building Enterprise Company Networks...
I also creating small databases in Access (Greatest Thanks You All for helping me in Development)
 

vbaInet

AWF VIP
Local time
Today, 19:36
Joined
Jan 22, 2010
Messages
26,374
Well, I will be coming to you for SysAdmin advice ;)

What did you do?
 

Simon_MT

Registered User.
Local time
Today, 19:36
Joined
Feb 26, 2007
Messages
2,177
The best method is to dclare the Image Directory, then change this declaration:
Code:
Function GetPictureDir() As String

    GetPictureDir = Forms![Menu]![ImageDirectory] or 
    GetPictureDir ="D:\DB\IMG\

End Function
Then
Code:
Function GetPicturePath()
        
    With CodeContextObject
        GetPicturePath = GetPictureDir & .[ImageFile]
    End With
End Function
Simon
 

vbaInet

AWF VIP
Local time
Today, 19:36
Joined
Jan 22, 2010
Messages
26,374
But why hard code the path when you can save it in a table? This is what relational dbs is all about.

The table can contain an ID and a path to the DIR with the ID linked to the File Name. A change in the DIR is only required once because the path to the DIR is changed once.
 

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Top Bottom