Image control on form - not displaying the image stored in a file

I

Icebox

I'm using Access 2007. I have a multitable form that is used for a form in a
photo asset database. I want to display the photo on the form. I've added
an image control to the form, and I'm having trouble setting the control
source property to display the images I have stored in a directory.

The db has an image table storing paths and filenames, the relevant fields
being "Image Path" and "Front Image" which is the filename. Paths are saved
as relative so the database can be used on a desktop and laptop that have
different file structures. So, typical Image Path data would look like this
".\Images\0000\"

I've tried using the expression builder on the property page for the Image
control, but I'm not having success. One thing I noticed when I added the
Image Path field to the table as text, the field wasn't displaying the
leading "."
So my problems seem to be
1) Incorrect relative path naming
2) forming an expression to join two fields together for the control source.

Any help would be appreciated. Thanks!
 
D

Douglas J. Steele

I don't think you should be relying on relative path. Using a relative path
relies on the current directory, and how do you know what the current
directory is? (Hint: It's seldom the folder where the database resides)
 
I

Icebox

Good point Douglas,

I've changed the path reference to be the full path to the file location,
but still no luck. The expression that I've got for the control source is
this:
=[Image Data]![Image Path] & [Image Data]![Front Image]
I guess either 1) the method I'm using doesn't work or 2) there's a problem
with the expression. Any ideas? I'm at a loss.

thanks
Mark
 
D

Douglas J. Steele

I don't believe you can include the table in the reference like that.

Try just

=[Image Path] & [Front Image]

That assumes that Image Path ends in a slash. If you're not sure, try

=IIf(Right([Image Path], 1) = "/", [Image Path], [Image Path] & "/") &
[Front Image]

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)



Icebox said:
Good point Douglas,

I've changed the path reference to be the full path to the file location,
but still no luck. The expression that I've got for the control source is
this:
=[Image Data]![Image Path] & [Image Data]![Front Image]
I guess either 1) the method I'm using doesn't work or 2) there's a
problem
with the expression. Any ideas? I'm at a loss.

thanks
Mark

Douglas J. Steele said:
I don't think you should be relying on relative path. Using a relative
path
relies on the current directory, and how do you know what the current
directory is? (Hint: It's seldom the folder where the database resides)
 
I

Icebox

The path field ends in a backslash, isn't that how it should end? All the
directory changes are marked with backslashes in the image path field.
That's how windows and dos paths have always been indicated as far as I know.


I tried deleting the table name from the expression, and that didn't solve
the problem. All I see is the blank image field. Right now, when I open the
image data table, I can see that the link between that table and the main
data table is working correctly. The two fields referenced have correct
references to the full path, and filenames of the images. This seems like
it should work; I don't get it.

Mark
Douglas J. Steele said:
I don't believe you can include the table in the reference like that.

Try just

=[Image Path] & [Front Image]

That assumes that Image Path ends in a slash. If you're not sure, try

=IIf(Right([Image Path], 1) = "/", [Image Path], [Image Path] & "/") &
[Front Image]

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)



Icebox said:
Good point Douglas,

I've changed the path reference to be the full path to the file location,
but still no luck. The expression that I've got for the control source is
this:
=[Image Data]![Image Path] & [Image Data]![Front Image]
I guess either 1) the method I'm using doesn't work or 2) there's a
problem
with the expression. Any ideas? I'm at a loss.

thanks
Mark

Douglas J. Steele said:
I don't think you should be relying on relative path. Using a relative
path
relies on the current directory, and how do you know what the current
directory is? (Hint: It's seldom the folder where the database resides)

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


I'm using Access 2007. I have a multitable form that is used for a form
in
a
photo asset database. I want to display the photo on the form. I've
added
an image control to the form, and I'm having trouble setting the
control
source property to display the images I have stored in a directory.

The db has an image table storing paths and filenames, the relevant
fields
being "Image Path" and "Front Image" which is the filename. Paths are
saved
as relative so the database can be used on a desktop and laptop that
have
different file structures. So, typical Image Path data would look like
this
".\Images\0000\"

I've tried using the expression builder on the property page for the
Image
control, but I'm not having success. One thing I noticed when I added
the
Image Path field to the table as text, the field wasn't displaying the
leading "."
So my problems seem to be
1) Incorrect relative path naming
2) forming an expression to join two fields together for the control
source.

Any help would be appreciated. Thanks!
 
D

Douglas J. Steele

Okay, if you've got the trailing slash, then =[Image Path] & [Front Image]
should be sufficient.

It's the ControlSource property you need to be setting, btw, not the Picture
property.

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)



Icebox said:
The path field ends in a backslash, isn't that how it should end? All the
directory changes are marked with backslashes in the image path field.
That's how windows and dos paths have always been indicated as far as I
know.


I tried deleting the table name from the expression, and that didn't solve
the problem. All I see is the blank image field. Right now, when I open
the
image data table, I can see that the link between that table and the main
data table is working correctly. The two fields referenced have correct
references to the full path, and filenames of the images. This seems
like
it should work; I don't get it.

Mark
Douglas J. Steele said:
I don't believe you can include the table in the reference like that.

Try just

=[Image Path] & [Front Image]

That assumes that Image Path ends in a slash. If you're not sure, try

=IIf(Right([Image Path], 1) = "/", [Image Path], [Image Path] & "/") &
[Front Image]

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)



Icebox said:
Good point Douglas,

I've changed the path reference to be the full path to the file
location,
but still no luck. The expression that I've got for the control source
is
this:
=[Image Data]![Image Path] & [Image Data]![Front Image]
I guess either 1) the method I'm using doesn't work or 2) there's a
problem
with the expression. Any ideas? I'm at a loss.

thanks
Mark

:

I don't think you should be relying on relative path. Using a relative
path
relies on the current directory, and how do you know what the current
directory is? (Hint: It's seldom the folder where the database
resides)

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


I'm using Access 2007. I have a multitable form that is used for a
form
in
a
photo asset database. I want to display the photo on the form.
I've
added
an image control to the form, and I'm having trouble setting the
control
source property to display the images I have stored in a directory.

The db has an image table storing paths and filenames, the relevant
fields
being "Image Path" and "Front Image" which is the filename. Paths
are
saved
as relative so the database can be used on a desktop and laptop that
have
different file structures. So, typical Image Path data would look
like
this
".\Images\0000\"

I've tried using the expression builder on the property page for the
Image
control, but I'm not having success. One thing I noticed when I
added
the
Image Path field to the table as text, the field wasn't displaying
the
leading "."
So my problems seem to be
1) Incorrect relative path naming
2) forming an expression to join two fields together for the control
source.

Any help would be appreciated. Thanks!
 
I

Icebox

I'm setting the control source property. I noticed the picture property, but
I'm not using it.

I just set up a test form to try what you suggested in a blank form. I just
made a single table form from the Image Data table, and successfully got the
photos to display using the expression you suggested. Next I tried setting
up a simple form based on the main table (which was how the original form was
built), showing the key field that links the main and image table, and the
image path field from the image data table, and an image box with the same
expression that worked in the single table form, and now the image will not
display. What do you think is causing this?

Douglas J. Steele said:
Okay, if you've got the trailing slash, then =[Image Path] & [Front Image]
should be sufficient.

It's the ControlSource property you need to be setting, btw, not the Picture
property.

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)



Icebox said:
The path field ends in a backslash, isn't that how it should end? All the
directory changes are marked with backslashes in the image path field.
That's how windows and dos paths have always been indicated as far as I
know.


I tried deleting the table name from the expression, and that didn't solve
the problem. All I see is the blank image field. Right now, when I open
the
image data table, I can see that the link between that table and the main
data table is working correctly. The two fields referenced have correct
references to the full path, and filenames of the images. This seems
like
it should work; I don't get it.

Mark
Douglas J. Steele said:
I don't believe you can include the table in the reference like that.

Try just

=[Image Path] & [Front Image]

That assumes that Image Path ends in a slash. If you're not sure, try

=IIf(Right([Image Path], 1) = "/", [Image Path], [Image Path] & "/") &
[Front Image]
 
I

Icebox

Actually Doug, I figured out a way to get the images to display after several
hours of tinkering with various solutions on the net. I'm sending the path
to the picture property and it works.

Now I've got a different question.

When using the attachment field type, clicking on an image sends that image
to the system's default image viewing program to open. I'd like to have the
same behavior if the image box is doubleclicked. I see there is a on
doubleclick property, but I can't figure out if its possible to send the
contents of the picture property to an external program to view. Is this
possible?

I greatly appreciate the help you've given. I got the ideas for the code
that broke the original problem from the links on your site.

Mark

Icebox said:
I'm setting the control source property. I noticed the picture property, but
I'm not using it.

I just set up a test form to try what you suggested in a blank form. I just
made a single table form from the Image Data table, and successfully got the
photos to display using the expression you suggested. Next I tried setting
up a simple form based on the main table (which was how the original form was
built), showing the key field that links the main and image table, and the
image path field from the image data table, and an image box with the same
expression that worked in the single table form, and now the image will not
display. What do you think is causing this?

Douglas J. Steele said:
Okay, if you've got the trailing slash, then =[Image Path] & [Front Image]
should be sufficient.

It's the ControlSource property you need to be setting, btw, not the Picture
property.

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)



Icebox said:
The path field ends in a backslash, isn't that how it should end? All the
directory changes are marked with backslashes in the image path field.
That's how windows and dos paths have always been indicated as far as I
know.


I tried deleting the table name from the expression, and that didn't solve
the problem. All I see is the blank image field. Right now, when I open
the
image data table, I can see that the link between that table and the main
data table is working correctly. The two fields referenced have correct
references to the full path, and filenames of the images. This seems
like
it should work; I don't get it.

Mark
:

I don't believe you can include the table in the reference like that.

Try just

=[Image Path] & [Front Image]

That assumes that Image Path ends in a slash. If you're not sure, try

=IIf(Right([Image Path], 1) = "/", [Image Path], [Image Path] & "/") &
[Front Image]
 
I

Icebox

Never mind, I figured this out too. Thanks for your help Doug, I learned a
lot doing this.

Icebox said:
Actually Doug, I figured out a way to get the images to display after several
hours of tinkering with various solutions on the net. I'm sending the path
to the picture property and it works.

Now I've got a different question.

When using the attachment field type, clicking on an image sends that image
to the system's default image viewing program to open. I'd like to have the
same behavior if the image box is doubleclicked. I see there is a on
doubleclick property, but I can't figure out if its possible to send the
contents of the picture property to an external program to view. Is this
possible?

I greatly appreciate the help you've given. I got the ideas for the code
that broke the original problem from the links on your site.

Mark

Icebox said:
I'm setting the control source property. I noticed the picture property, but
I'm not using it.

I just set up a test form to try what you suggested in a blank form. I just
made a single table form from the Image Data table, and successfully got the
photos to display using the expression you suggested. Next I tried setting
up a simple form based on the main table (which was how the original form was
built), showing the key field that links the main and image table, and the
image path field from the image data table, and an image box with the same
expression that worked in the single table form, and now the image will not
display. What do you think is causing this?

Douglas J. Steele said:
Okay, if you've got the trailing slash, then =[Image Path] & [Front Image]
should be sufficient.

It's the ControlSource property you need to be setting, btw, not the Picture
property.

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)



The path field ends in a backslash, isn't that how it should end? All the
directory changes are marked with backslashes in the image path field.
That's how windows and dos paths have always been indicated as far as I
know.


I tried deleting the table name from the expression, and that didn't solve
the problem. All I see is the blank image field. Right now, when I open
the
image data table, I can see that the link between that table and the main
data table is working correctly. The two fields referenced have correct
references to the full path, and filenames of the images. This seems
like
it should work; I don't get it.

Mark
:

I don't believe you can include the table in the reference like that.

Try just

=[Image Path] & [Front Image]

That assumes that Image Path ends in a slash. If you're not sure, try

=IIf(Right([Image Path], 1) = "/", [Image Path], [Image Path] & "/") &
[Front Image]
 

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