Images in Reports

K

kt2902

I've searched through the message boards and I can't seem to an answer to my
particular question, so here goes:

I have a company logo at the top of all my reports. Rather than embed the
image I linked it to an image stored in the subfolder of the back end of the
database. The linking is originally done in the properties of the report and
then updated via VBA when the report is opened.

This is all works fine until I install the database on a different computer
and the pathname changes. Although the VBA linking works fine, I get an error
message first because it can't find the original image. The ideal situation
would be to have an empty image box on my report that is updated every time
the report is printed, but I don't know how to insert an empty image frame.

Any suggestions? Thanks in advance

Kate
 
B

bob

Although Access forces you to choose an image file when you insert an Image Control, once it is inserted
you can clear the "Picture" property to remove the image, leaving a blank control that you can load at
runtime (by setting the "Picture" property to the full path to the image in the relevant event-handler).


The following article contains code to get the path to the back-end database, so if you store the image
in the same folder as the back-end (or a subfolder) you can build the path dynamically and you won't have
to remember to update hard-coded paths if the database is ever moved. See Option (3) for split databases,
and remember to replace the table name with the name of a linked table in your database:

http://tinyurl.com/y3vzzp


It's also a good idea to verify that the file exists before loading it, to avoid an error message. For
example:

strPath = GetDBPath & "images\logo.jpg"
If Len(Dir(strPath)) > 0 Then
Image0.Picture = strPath
End If
 

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