Adding Graphics to a Report - Increases Database Size too much

S

Sarah

I added graphics into the header and footer of a couple of my reports and it
added so much to the size of my to my database. The graphics were copied and
pasted from a 271kb Word file. Why does it increase the size of my database
so much - I think it increases 5mg per graphic.

Any ideas would be greatly appreciated.

Sarah
 
E

Evi

Paste the graphics one at a time into eg IrfanView (wonderful freeware app)
and go to File, Save As and save them into a folder as PNGs. Irfanview will
let you do this. Put your db into the same folder so they will always stay
together. Note the file path to your pictures. In Windows Explorer, Tools,
Options, Folder Options, View, tick the box that says 'Show Full file path.
You can then copy this by pressing Ctrl & C. Note the name of your picture

In your report, in Design View go to Insert, Picture. Choose anything - it
doesn't matter.
Size the frame to the size you want it to be.
Click the the newly inserted frame, click on Properties
On the Format tab, next to Picture, delete the file path next to Picture.
Say yes you want to delete the picture. Next to picture, it will now say
(none) but your Image Frame will remain as a white square. On the Other tab
rename the frame to Pic1.
Next to Size Mode choose Zoom.
Click on the grey bar above above the section which holds your picture
frame.

In Properties, click on Events and On Format. Choose Event Procedure.

In the code page just above where it says End Sub put


Me.Pic1.Picture = "E:\Downloads\EvsClipArt\Animals\OURPETS\dog.png"

(substitute your own file path and file name of course, remembering the file
extension)
Add similar lines for the other pictures
so your whole code will now say:

Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)

Me.Pic1.Picture = "E:\Downloads\EvsClipArt\Animals\OURPETS\dog.png"
Me.Pic1.Picture = "E:\Downloads\EvsClipArt\Animals\OURPETS\cat.png"
End Sub


Evi
 
S

Sarah

Thank you Evi, this worked perfectly. Is there a way to have it default to
the folder they system is running in verses having to include the entire
filename path. The system is sometimes downloaded to other pcs to run and
the path will be wrong.

Thanks for your assistance.
 
E

Evi

Not sure what you mean by 'default to the folder the system is running',
Sarah.

Will the pictures always be kept in the same folder as the database so that
you need the code to look up which drive the database is currently in? This
can be done.

You can make things more flexible by having a table for the different file
paths and one for the picture names. If the pictures are always kept
together in the same folder then you can put a link to the File Path table
in your picture table, otherwise you would use a third table to combine
picture and current file path. Use combo boxes in a form to make this easy
to choose.
A query will simply concatenate the 2 phrases and your code for filling the
pictures will include a DLookup to find the current file path for that
image.
eg

Dim MyPath as string

MyPath = DLookup("[FullFilePath]","QryMyQuery","[PicID]=" & 3)

Me.Pic1.Picture = MyPath
Evi
 

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