HELP - OLE bitmap issue

B

Brett Kinross

I have a podiatry database. I use an embeded OLE field for each client in
which I load a diagram of the foot to draw on for illustration purposes. When
the picture is loaded it displays clearly in the OLE field, and double
clicking allows you to edit in MS Paint within the OLE field itself.

This has been working well (except for the impact on file sizes) for the
past few years. However I recently installed Macromedia Fireworks (an image
program) and made it my default program for jpegs, bitmaps etc. Now though
when my bitmap loads within the OLE field only a small thumbnail can be seen
with the file name written underneath (previously no file name was visible
and the bitmap filled the whole OLE field).

When I double click to edit it then opened up Macromedia Fireworks in a
seperate window to edit it. When I changed bitmaps to open in MS Paint
instead it continued to open in MS Paint but in a seperate window and was not
editable in the OLE field itself and continued displaying "wrongly" as
before. Bitmaps that have been previously entered still display/function
correctly. When right clicking on the OLE field the new pictures have a
"Package Object" menu item where as previously it displayed "Bitmap Image
Object".

How can I get it back to displaying as it originally did?!?

Thanks for your help
Brett Kinross
 
S

Stephen Lebans

You need to return the file associations for the Bitmap image format to MS
Paint. Here is a previous post of mine on this subject:

Newsgroups: microsoft.public.access.forms
From: "Stephen Lebans"
<ForEmailGotoMy.WebSite.-WWWdo­tlebans­[email protected]> - Find
messages by this author
Date: Mon, 29 Nov 2004 20:52:36 -0400
Local: Mon,Nov 29 2004 7:52 pm
Subject: Re: .jpg pictures are allowed to store as OLE objects?
Reply to Author | Forward | Print | Individual Message | Show original |
Report Abuse


The format of the image file is completely independant of Access. It is
the responsibility of whatever Image/Paint program is currently
registered with WIndows to view the Image file types and act as the OLE
server for the object inserted into the OLE object field.
MS Photo Editor is generally used as the OLE server for Access. It must
be setup and registered to handle the selected image file types.


Before I explain how to setup Photo Editor to be registeredd for the
relevant Image file types one note of caution. Images embedded as OLE
objects will quickly fill up your MDB. A small 40KB JPG can end up
consuming several MB's in storage space. If you are planning on storing
a large number of images or even a few extremely high resolution images
then you should not be using OLE.


Why do Images embedded as OLE objects take up so much storage space?


In a nutshell:
An Image inserted as an OLE object is no longer the same size as the
original file. It is converted to a DIB(uncompressed Bitmap) and then
wrapped in a EMF(Enhanced Metafile). THe EMF is then wrapped within the
OLE stream. Further, if the original Image was not a Bitmap or Metafile,
then another full size DIB preview is inserted into the OLE stream.


THe only reasons to use an OLE object field are if you require:


1) The ability for your users to Edit the Image in the Program that acts
as the OLE server.
2) The ability to view the Images with a Form in Continuous View.
3) The Images are embedded for security concerns.


In reality, the enormous OLE file size "bloating" stops most users from
inserting more than a few images. With the exception of viewing the
images with a Form in Continuous view, coding solutions for the other 2
issues are available.


The most common solution is to simply keep the images in a seperate
folder storing the filenames only in a Text field. Using the Current
event of the Form or the Format event of the relevant section on a
Report, place a line of code to load the picture into the standard Image
control NOT the OLE Frame control.


Me.NameOfPictureControl.Pictur­­e Me.NameOfTextBoxBoundToFileNam­­eField


There is lots of sample code out there complete with error checking.
Search GoogleGroups.


******************************­­***************
Here is a previous post of mine on for how to setup MS Photo Editor:
Message 4 in thread
From: Stephen Lebans
(ForEmailGotoMy.WebSite.-WWWdo­­[email protected])
Subject: Re: Inserting picture into an access form


View this article only
Newsgroups: microsoft.public.access.active­­xcontrol
Date: 2004-11-12 19:43:08 PST


In this case the OLE server is simply an Image/paint program that:
1) Can function as an OLE Image server
2) Is registered to handle the specific Image file types you want to
insert into the OLE obect field.


In most cases, MS Photo Editor is used as the OLE Server program. It
must though, be setup as the default/registered handler for the image
file types in question. MS Photo Editor is no longer included with
Office 2003. YOu will have to find you Office XP or WIn2K disks and
install MS Photo Editor only!


The simplest method to associate a program with a specific file
extension(BMP,JPG,etc.) is to:
1) Open a folder containing the Images you want to insert.
2) Right click on a file while holding down the SHift key.
3) From the popup menu select "Open With".
4) Scroll down the Open With Dialog window until you find MS Photo
Editor and select it.
5) Check the Always use this program to open this file type CheckBox
control.
6) Click OK.


Repeat the steps once for each different type of Image file you want to
embedd in your table.
******************************­­***************



--

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

Brett Kinross

Hi Stephen and thanks for your reply

I had already changed the file association back to MS Paint however when the
image is embedded, either through code or menu option, it embeds as a little
thumbnail with the file name underneath it rather than expanding the bitmap
to fill the whole OLE field. Futhermore when I double click on it to edit it
it opens MS Paint as a seperate program rather than being able to edit in the
OLE field directly.

For what its worth the reasons I am using an OLE field for this are, as you
alluded to:
1) The ability for your users to Edit the Image in the Program that acts
as the OLE server.
2) The ability to view the Images with a Form in Continuous View.
For all other pictures (i.e. photos) I just store the pathway and load it
into the image box.
With around 2,000 bitmaps stored in the database it is "only" 100MB in size
and currently I find that as an acceptable trade-off.

If you could help me resolve this issue and get the OLE bitmaps to display
fully in the OLE field rather than as a thumbnail with the filename
underneath it would be greatly appreciated.

Cheers
Brett
 
S

Stephen Lebans

If you look at the table directly in table Datasheet view, what does it say
in the OLE field for the problem records containing the Bitmaps?

--

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


Brett Kinross said:
Hi Stephen and thanks for your reply

I had already changed the file association back to MS Paint however when
the
image is embedded, either through code or menu option, it embeds as a
little
thumbnail with the file name underneath it rather than expanding the
bitmap
to fill the whole OLE field. Futhermore when I double click on it to edit
it
it opens MS Paint as a seperate program rather than being able to edit in
the
OLE field directly.

For what its worth the reasons I am using an OLE field for this are, as
you
alluded to:
1) The ability for your users to Edit the Image in the Program that acts
as the OLE server.
2) The ability to view the Images with a Form in Continuous View.
For all other pictures (i.e. photos) I just store the pathway and load it
into the image box.
With around 2,000 bitmaps stored in the database it is "only" 100MB in
size
and currently I find that as an acceptable trade-off.

If you could help me resolve this issue and get the OLE bitmaps to display
fully in the OLE field rather than as a thumbnail with the filename
underneath it would be greatly appreciated.

Cheers
Brett
 
B

Brett Kinross

Hi again Stephen

In the datasheet view it is listed as "Package" while all the previous
entries are "Bitmap Image".
 
S

Stephen Lebans

Then MS Paint is not the application functioning as the OLE server to insert
the Bitmap.
Two questions.

1) When you double click on a Bitmap file in the Explorer window what
application open to display the file?

2) What are the exact steps you are following to insert the Bitmap?

--

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

Brett Kinross

Once again thanks for your assistance. Here are the answers to your questions.
1) When you double click on a Bitmap file in the Explorer window what
application open to display the file?

MS Paint version 5.1
2) What are the exact steps you are following to insert the Bitmap?

Doesn't seem to matter how I insert it (code or through the menu) but this
is the following code I use:

Private Sub cmdLoadOLE_Click()
Dim Msg As String
Dim PicPath As String

If Me.RecordsetClone.RecordCount < 2 Then
DoCmd.GoToRecord , , acNewRec
PicPath = MergeDir & "Foot DorsumBMPS.bmp"
LoadOLE Me!OLEFile, PicPath, True
Else
Msg = "You can only have two pictures." & vbCrLf
Msg = Msg & "Please delete one of the pictures first."
MsgBox Msg, vbExclamation, "Maximum number of pictures exceeded ...."
End If
End Sub

Function LoadOLE(OLECtrl As Variant, strSource As String, Optional blnEmbed
As Boolean)
On Error GoTo Err_LoadOLE
' OLECtrl refers to the OLE control on the form
' strSource refers to the string pertaining to the location of the file
to link/embed
' if blnEmbed = true then OLE is embedded else it is linked

If blnEmbed = True Then
OLECtrl.OLETypeAllowed = acOLEEmbedded
OLECtrl.SourceDoc = strSource
OLECtrl.Action = acOLECreateEmbed
Else
OLECtrl.OLETypeAllowed = acOLELinked
OLECtrl.SourceDoc = strSource
OLECtrl.Action = acOLECreateLink
End If

Exit_LoadOLE:
Exit Function

Err_LoadOLE:
MsgBox Err.Description
Resume Exit_LoadOLE

End Function

Cheers
Brett
 
S

Stephen Lebans

Very strange. The pertinent registry entries are still screwed up. Have you
rebooted your machine since you followed the steps I outlined to restore the
file registrations?

Finally, for your code solution, add the line:

OLECtrl.Class = "Paint.Picture"

--

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

Brett Kinross

Hi Stephen

Yes I've rebooted and it still didn't work. Also I added the extra code and
it made no difference. I think I might've had a similar problem about five
years ago and an Office repair fixed it. I might try reinstalling MS Paint
and see if that works - hopefully it will fix up the file registrations to MS
Paint. Unfortunately it is an outside IT company at this workplace so it will
probably take a few weeks to get done (much prefer it when I can just do it
myself). I will post back here after with the results to let everyone know -
unless you can think of another option of course.

Once again thanks for your assistance, both now and in the past. I have
found your website invaluable and it was a great help over the years in my
formative foray into Access.

Cheers
Brett Kinross
 
B

Brett Kinross

Solved!

Thought I'd post what I did to help anyone else. Rather than reinstall MS
Paint I just did a System Restore to when I installed Macromedia Fireworks.
Now it works beautifully.

Thankyou for all your efforts Stephen in trying to fix this annoying problem.

Cheers
Brett Kinross
 

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