Displaying Images on Forms

T

Tom Gettys

In the article "How to Display Images in a Form Without Storing the Images in
a Table" it is explained that you put the filename in a text box, add an
image control to the form, and then put a tiny bit of code in the OnCurrent &
After Update events:

Me![name of image control].Picture=Me![name of text field w/filename]

It works, or seems to. However, when I exit Access and then restart it, it
stops working!

I have found that it starts working again if I go into design view on the
form and reselect an image for the image control using the ... button.

I am not providing fully qualified filenames in the text field because the
images are in the same directory as the database (I had assumed the default
directory would be the current directory).

I am perplexed by this behavior - any thoughts???
 
R

Rick Brandt

Tom Gettys said:
In the article "How to Display Images in a Form Without Storing the Images in
a Table" it is explained that you put the filename in a text box, add an
image control to the form, and then put a tiny bit of code in the OnCurrent &
After Update events:

Me![name of image control].Picture=Me![name of text field w/filename]

It works, or seems to. However, when I exit Access and then restart it, it
stops working!

I have found that it starts working again if I go into design view on the
form and reselect an image for the image control using the ... button.

I am not providing fully qualified filenames in the text field because the
images are in the same directory as the database (I had assumed the default
directory would be the current directory).

I am perplexed by this behavior - any thoughts???

Your assumption is wrong. Include the full path.
 
S

Stephen Lebans

I'll guess that once you manually select an image to load into the Image
control, the current path remains the default path for any further
images you load into the Image control durring the current session.

Just make a small modification to your existing code to add the desired:

Me![name of image control].Picture="C:\TheFullPathToYourImages\" &
Me![name of text field w/filename]


--

HTH
Stephen Lebans
http://www.lebans.com
Access Code, Tips and Tricks
Please respond only to the newsgroups so everyone can benefit.
 
T

Tom Gettys

Very cool! Thanks a bunch Stephen!

Stephen Lebans said:
I'll guess that once you manually select an image to load into the Image
control, the current path remains the default path for any further
images you load into the Image control durring the current session.

Just make a small modification to your existing code to add the desired:

Me![name of image control].Picture="C:\TheFullPathToYourImages\" &
Me![name of text field w/filename]


--

HTH
Stephen Lebans
http://www.lebans.com
Access Code, Tips and Tricks
Please respond only to the newsgroups so everyone can benefit.


Tom Gettys said:
In the article "How to Display Images in a Form Without Storing the Images in
a Table" it is explained that you put the filename in a text box, add an
image control to the form, and then put a tiny bit of code in the OnCurrent &
After Update events:

Me![name of image control].Picture=Me![name of text field w/filename]

It works, or seems to. However, when I exit Access and then restart it, it
stops working!

I have found that it starts working again if I go into design view on the
form and reselect an image for the image control using the ... button.

I am not providing fully qualified filenames in the text field because the
images are in the same directory as the database (I had assumed the default
directory would be the current directory).

I am perplexed by this behavior - any thoughts???
 
S

short_sweet

This solution works for the first form, but when you go to the next form the
images that you had in the first form carry over. Is there any way to stop
this? When I go to the next (new) form I would like to have a default image
that displays instead of the ones from the first form.

Thank you,
Short_sweet

Stephen Lebans said:
I'll guess that once you manually select an image to load into the Image
control, the current path remains the default path for any further
images you load into the Image control durring the current session.

Just make a small modification to your existing code to add the desired:

Me![name of image control].Picture="C:\TheFullPathToYourImages\" &
Me![name of text field w/filename]


--

HTH
Stephen Lebans
http://www.lebans.com
Access Code, Tips and Tricks
Please respond only to the newsgroups so everyone can benefit.


Tom Gettys said:
In the article "How to Display Images in a Form Without Storing the Images in
a Table" it is explained that you put the filename in a text box, add an
image control to the form, and then put a tiny bit of code in the OnCurrent &
After Update events:

Me![name of image control].Picture=Me![name of text field w/filename]

It works, or seems to. However, when I exit Access and then restart it, it
stops working!

I have found that it starts working again if I go into design view on the
form and reselect an image for the image control using the ... button.

I am not providing fully qualified filenames in the text field because the
images are in the same directory as the database (I had assumed the default
directory would be the current directory).

I am perplexed by this behavior - any thoughts???
 

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