Using text field to display images on a form or report

J

John F

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
 
J

John F

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.
 
J

John F

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 said:
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 said:
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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top