Prev: Custom Record Selector Controls that don't work like the built-in ones
Next: Custom Record Selector Controls that don't work like the built-in ones
From: John F on 24 May 2010 06:36 I was going to use attachments to do this instead of a text field but after rummaging around here I have nod decided to use a text field. Access knows where it started up from. Can this information be used in a way that the image file can be accessed relative to where access started up in order to be able to move the folder or copy the database to another computer without breaking the qualified path and having to recreate all of the path names to display the images? If this is possible then how is it implemented? Thanks in advance
From: BruceM via AccessMonster.com on 24 May 2010 09:28 CurrentProject.Path will give you the path to the folder in which the application (the current database) resides. You should also be able to use the UNC path (\\ServerName\ShareName\ FolderName) to the desired folder. It sounds as if everybody is using a single database file on a network location, and you want everybody to be able to use the mapped drive letters they used to get there. Sharing a single database file by multiple users is apt to lead to corruption, which can be especially vexing if the data (tables) are in the same file as the forms, reports, and queries. Best practice is to split the application between front end (user interface) and back end (data files), and give each user their own copy of the front end. In that case you will need to use either the UNC path, or have something like a local settings table where each user can store mapped drive letters and such. UNC path is simpler to implement. More here on splitting: http://allenbrowne.com/ser-01.html John F wrote: >I was going to use attachments to do this instead of a text field but after >rummaging around here I have nod decided to use a text field. > >Access knows where it started up from. Can this information be used in a way >that the image file can be accessed relative to where access started up in >order to be able to move the folder or copy the database to another computer >without breaking the qualified path and having to recreate all of the path >names to display the images? If this is possible then how is it implemented? > >Thanks in advance -- Message posted via AccessMonster.com http://www.accessmonster.com/Uwe/Forums.aspx/access-formscoding/201005/1
From: John F on 24 May 2010 11:24 It is a single user database that I use at home on my desktop computer and when I travel I transfer the database to my laptop. Unfortunatly the fully qualified file name is different for each respective computer. All I wanted to be able to do is not have to recreate links to the images that is the reason I'm looking to make the path relative to the folder that contains the database and subfoldes contain the image files. I am not familar with the use of CurrentProject.Path, how would this be used with an unbound box that displayes the image in the form? I have the boxes displaying the images now but as configured the box is displaying the image base on a fully qualified path stored in a text field. "BruceM via AccessMonster.com" wrote: > CurrentProject.Path will give you the path to the folder in which the > application (the current database) resides. > > You should also be able to use the UNC path (\\ServerName\ShareName\ > FolderName) to the desired folder. It sounds as if everybody is using a > single database file on a network location, and you want everybody to be able > to use the mapped drive letters they used to get there. Sharing a single > database file by multiple users is apt to lead to corruption, which can be > especially vexing if the data (tables) are in the same file as the forms, > reports, and queries. > > Best practice is to split the application between front end (user interface) > and back end (data files), and give each user their own copy of the front end. > In that case you will need to use either the UNC path, or have something like > a local settings table where each user can store mapped drive letters and > such. UNC path is simpler to implement. More here on splitting: > > http://allenbrowne.com/ser-01.html > > > John F wrote: > >I was going to use attachments to do this instead of a text field but after > >rummaging around here I have nod decided to use a text field. > > > >Access knows where it started up from. Can this information be used in a way > >that the image file can be accessed relative to where access started up in > >order to be able to move the folder or copy the database to another computer > >without breaking the qualified path and having to recreate all of the path > >names to display the images? If this is possible then how is it implemented? > > > >Thanks in advance > > -- > Message posted via AccessMonster.com > http://www.accessmonster.com/Uwe/Forums.aspx/access-formscoding/201005/1 > > . >
From: BruceM via AccessMonster.com on 24 May 2010 11:50 CurrentProject.Path gives the path to the database. If the images folder (I will call it Images) is located in the same folder as the database you could do: Dim strPath as String strPath = CurrentProject.Path & "\Images" I don't know how exactly you are displaying the images, but presumably it involves a path to the images folder. Use the above instead of the path you are now using. There may be more going on here than I understand, as I don't see why you don't just use the same folder name for both computers. You mention the desktop and laptop computers, but then there is the phrase "each respective computer", so are there more than two computers, or what exactly? John F wrote: >It is a single user database that I use at home on my desktop computer and >when I travel I transfer the database to my laptop. Unfortunatly the fully >qualified file name is different for each respective computer. All I wanted >to be able to do is not have to recreate links to the images that is the >reason I'm looking to make the path relative to the folder that contains the >database and subfoldes contain the image files. > >I am not familar with the use of CurrentProject.Path, how would this be used >with an unbound box that displayes the image in the form? I have the boxes >displaying the images now but as configured the box is displaying the image >base on a fully qualified path stored in a text field. > >> CurrentProject.Path will give you the path to the folder in which the >> application (the current database) resides. >[quoted text clipped - 25 lines] >> > >> >Thanks in advance -- Message posted via http://www.accessmonster.com
From: John F on 24 May 2010 12:56
I am storing the database in "My Documents", on the desktop which has multiple HDs and is on drive D: and on the laptop which has 1 HD it is on drive C:, this is the only difference in the path name. How I am displaying the image is using an “Image Box” with a control source set to [txtPath] which is the field that stores the path to the image which looks like D:\users\my name\documents\the database folder\Images\name of picture.jpg and on the laptop it starts thus C:\users……………. "BruceM via AccessMonster.com" wrote: > CurrentProject.Path gives the path to the database. If the images folder (I > will call it Images) is located in the same folder as the database you could > do: > > Dim strPath as String > > strPath = CurrentProject.Path & "\Images" > > I don't know how exactly you are displaying the images, but presumably it > involves a path to the images folder. Use the above instead of the path you > are now using. > > There may be more going on here than I understand, as I don't see why you > don't just use the same folder name for both computers. You mention the > desktop and laptop computers, but then there is the phrase "each respective > computer", so are there more than two computers, or what exactly? > > John F wrote: > >It is a single user database that I use at home on my desktop computer and > >when I travel I transfer the database to my laptop. Unfortunatly the fully > >qualified file name is different for each respective computer. All I wanted > >to be able to do is not have to recreate links to the images that is the > >reason I'm looking to make the path relative to the folder that contains the > >database and subfoldes contain the image files. > > > >I am not familar with the use of CurrentProject.Path, how would this be used > >with an unbound box that displayes the image in the form? I have the boxes > >displaying the images now but as configured the box is displaying the image > >base on a fully qualified path stored in a text field. > > > >> CurrentProject.Path will give you the path to the folder in which the > >> application (the current database) resides. > >[quoted text clipped - 25 lines] > >> > > >> >Thanks in advance > > -- > Message posted via http://www.accessmonster.com > > . > |