Display stored JPGs on a form

D

Dave

I have a table with an OLE Object data type field in which I insert a number
of JPG files by simply copying the file and pasting it into the table.

I create a form with a Bound Object Frame control that has as its control
source the OLE Object type field.

In Windows Explorer under Tools | Folder Options | File Types, I select the
JPG file type and change it from Internet Exploer to MS Office Picture
Manager or Windows Picture and Fax Viewer.

After this all that appears on my form is the control with the image name,
no image itself. When I click on this control, Picture Manager launches and
displays the image just as Internet Explorer used to do before I registered
the JPG file type with Picture Manager.

But I want the image to display _in the form_.

I even tried creating an AutoForm referencing the image table as someone in
a different thread suggested. This produces the same result as above, no
image, just a linked file name in the control.

Has anyone else done this?
 
B

Bill

In all of what you've described, it isn't quite clear
exactly what you're trying to accomplish. But first,
I might suggest that you avoid storing images into
Access databases. Rather, establish an image
library, preferrably jpg images, and then link to
the image as driven by the database. You can do
this by creating an image control with its "Picture"
source left blank and then let the "Sections" OnFormat
Event set the link to the desired image.

Something like:
Me.MyImageControl.Picture = Me.[MyDBField]

Where: MyDBField is a fully qualified path to the desired
image. (Not the best idea to store fully qualified paths
as a database field, as it doesn't provide the flexibility
to move your image library around.)

Alternatively:
Dim strImagePath as String 'Of the form: "c:\MyAppl\"
Dim strImageLib as String 'Of the form: "MyImageLib\"

Me.MyImageControl.Picture = strImagePath & strImageLib & MyDBField & ".jpg"

Post back if this suggestion doesn't match what you're
trying to accomplish.

Bill
 
D

Dave

Thanks Bill

I understand that storing images in an Access database does not make for the
most efficient application but it is convenient. I stored over 200 JPGs
which bloated the size of the mdb file to 165 MB but that's okay with me.
The response time is fine and everything is self contained so I am happy.

My problem is trying to display my stored image on a form.

As I mentioned, I have a Bound Object Frame control on a form that has as
its control source the OLE Object type field in which the JPG is stored..

When I call up the form the image does not display, only a place marker. If
I click on the place marker the image will open in Internet Explorer or
whatever OLE server I have specified for JPGs.

Maybe this is the best Access can do?

However, if I remember correctly, one of the old sample apps that used the
Northwinds database stored employee pictures (image files) in the database
and got them to display on the form. I can't seem to find that old mdb file
though.

Is what I am trying to do possible?




Bill said:
In all of what you've described, it isn't quite clear
exactly what you're trying to accomplish. But first,
I might suggest that you avoid storing images into
Access databases. Rather, establish an image
library, preferrably jpg images, and then link to
the image as driven by the database. You can do
this by creating an image control with its "Picture"
source left blank and then let the "Sections" OnFormat
Event set the link to the desired image.

Something like:
Me.MyImageControl.Picture = Me.[MyDBField]

Where: MyDBField is a fully qualified path to the desired
image. (Not the best idea to store fully qualified paths
as a database field, as it doesn't provide the flexibility
to move your image library around.)

Alternatively:
Dim strImagePath as String 'Of the form: "c:\MyAppl\"
Dim strImageLib as String 'Of the form: "MyImageLib\"

Me.MyImageControl.Picture = strImagePath & strImageLib & MyDBField &
".jpg"

Post back if this suggestion doesn't match what you're
trying to accomplish.

Bill


Dave said:
I have a table with an OLE Object data type field in which I insert a
number of JPG files by simply copying the file and pasting it into the
table.

I create a form with a Bound Object Frame control that has as its control
source the OLE Object type field.

In Windows Explorer under Tools | Folder Options | File Types, I select
the JPG file type and change it from Internet Exploer to MS Office
Picture
Manager or Windows Picture and Fax Viewer.

After this all that appears on my form is the control with the image
name, no image itself. When I click on this control, Picture Manager
launches and displays the image just as Internet Explorer used to do
before I registered the JPG file type with Picture Manager.

But I want the image to display _in the form_.

I even tried creating an AutoForm referencing the image table as someone
in a different thread suggested. This produces the same result as above,
no image, just a linked file name in the control.

Has anyone else done this?
 
P

Peter Yang[MSFT]

Hello Dave,

This is designed behavior of Access when you use bound object frame
control. It only supports to store/display BMP files since the current OLE
server mspaint only supports to display BMP via the control. However, you
may try to use third party OLE server/program to insert JPG files.


258644 A linked JPEG file is displayed as an icon on a form
http://support.microsoft.com/default.aspx?scid=kb;EN-US;258644


205635 How To Save Bitmap File as OLE Object in Access OLE Object Field
http://support.microsoft.com/default.aspx?scid=kb;EN-US;205635


As a workaround mentioned by Bill, you could try to store the files in a
folder

199066 ACC2000: How to Retrieve the Path for Linked OLE Objects
http://support.microsoft.com/default.aspx?scid=kb;EN-US;199066

Also, you could store the JPG files as BLOB in Access, and you could check
the following link for some samples:

http://accdevel.tripod.com/imaging.htm

If you have any further questions or concerns, please feel free to let's
know. Thank you.

Best Regards,

Peter Yang
MCSE2000/2003, MCSA, MCDBA
Microsoft Online Community Support
==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscriptions/managednewsgroups/default.aspx#notif
ications
<http://msdn.microsoft.com/subscriptions/managednewsgroups/default.aspx>.
Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
<http://msdn.microsoft.com/subscriptions/support/default.aspx>.
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.
 

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