Retrieve Embedded Picture

J

John

Hi,
Is there anyway to save an embedded picture in a form back to your hard
drive?
I have mistakenly deleted the original file.
I am using access 2007 Enterprise.

Kind Regards

John
 
B

BoniM

If it's unbound, in design view, right click on the picture and choose copy.
Open graphics program and paste. If it's a bound object, open the table it's
stored in and double click on the field to open it in the associated graphics
program. Save from there.
 
J

John

HI,
thanks for the reply but the picture is not bound to anything. It is
embedded into access not linked so I cannot click and save or do anything
else with it. I can delete it but there is no reference to the picture to
re-insert it?
Any ideas?

Kid Regards

John
 
B

BoniM

If you can select it to delete it, you can select it to copy it.

Open the form in design view.
Click once on the picture and click copy.
Open Paint or a better graphics program if you have it.
Click paste.
Save the picture.
 
J

John

BoniM
Thanks again for the reply. The picture is none selectable !
The picture is set as the Form picture not in the detail or headers and
footers and is embedded. This means the picture is not stored in the access
database as a file.
It is not set in a bound frame or object frame. i.e. a background image.

Regards

John
 
B

BoniM

Ahhhhhhhh.... sorry, I didn't understand that it was a background setting.
In THAT case if it's a picture you want really bad and don't have anywhere
else, do the following:
With the form closed, right click on it and choose copy.
Right click on an empty space in the form object area and choose paste.
Give a name like TempForPicture.
Open the TempForPicture form in design view and delete all of the controls,
leaving only the background picture.
Switch to form view.
Maximize or resize to see as much of the picture as you can or want, cause
this will only capture the visible part.
Hit the print screen key on the keyboard.
Open paint or other graphics program.
Click Paste.
If you need further instructions on how to get rid of everything in the
graphic except your picture, let me know.
Once you've saved your graphic, go back and delete the TempForPicture form.
Good luck!
 
J

John

BoniM
Thanks once again for the reply.
I have tried the copy and paste routine but it's not quite right. However I
think it's the best i'm going to get. Thanks again for all you help.

Kind Regards

John
 
S

Stephen Lebans

Here is sample code placed behind a CommandButton control on the form that
contains the embedded Image.

Private Sub cmdExtract_Click()
On Error GoTo Err_cmdExtract_Click


Dim pic As stdole.IPictureDisp
Set pic = SysCmd(712, Me.Form)

SavePicture pic, "C:\TinkerBell.bmp"

Set pic = Nothing

Exit_cmdExtract_Click:
Exit Sub

Err_cmdExtract_Click:
MsgBox Err.Description
Resume Exit_cmdExtract_Click

End Sub


--

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

John

Hi Stephan
Thanks for the reply,
Are you saying that if I put this code behind a command button in the
on_click event, it will save my picture "a png image by the way" as
c:\TinkerBell.bmp ?
I tried this and got an Illegal Function Call when clicked.?

Any more ideas please.

Regards

John
 
S

Stephen Lebans

In my original post I stated:


I have tested this with JPG and PNG files. It works with A97, A2K, A2K2 and
A2003.
Does your current setup have a Reference set to OLE Automation?
--

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

John

Stephen,
Yes I do have reference to OLE Automation ticked but I am using Access 2007,
could this be the issue?

Regards

John
 
S

Stephen Lebans

Yes it most likely is. Sorry, but I do not have A2007 here to debug.
Try converting your MDB to a previous version of Access. THe code I posted
will then work properly.

--

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

John

Tried converting it to all 3 DB Versions, still no luck.
Just to let you know my current situation.

I have an Blank form with a png file embedded as the Form Picture set to
"Top Left" Alingnment and Picture Size Mode "Stretch Horizontal".

The command button is in the Details section and the code is as you
suggested.

The database is has been saved as 2k, 2k2 and 2k3
I click the button and nothing happens. Should I get an indication that
this has worked?
I have checked the location c:\ for any files copied there but none show?

I understand you have tested it on your databases but I cannot get it to
work on this pain in the butt Database. If this cannot be accomplished, i
appologise for wasting your time and thankyou for your help.

Kind Regards

John
 
S

Stephen Lebans

John you need to convert the MDB to a previous version and then Open and run
a previous version of Access to execute the code I posted..

--

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

John

Stephan,
Eventually managed it.
Office 2007 does not export embedded imaged when backwards converted. I had
to export the form as a XML file and save the images to file during the
export. This is obviously a new part to office 2007. Thanks a million.

Kind Regards

John
 

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