Can I include a graphic in a report?

D

DaveF

I am using Access 2003.

I would like to include a grahic (gif file) in a report.

If I have a table with a field that has the graphic file name and path to
the file location on the local drive, is it possible to display the graphic
in the report?

I would prefer not to store the images in the database itself.

Prefereably I would just like the report to be able to read from the
specified location and display the images in the report.(e.g., a picture of
a product for each item of an inventory report.)

If anyone has done this, please give me some guidance on how to proceed.

Thanks
Dave
 
A

Allen Browne

In report design view, put an image control on your report where you want to
show the graphic. Access will ask you for the file name.

If the file will always be in that location, your job is now done.

If not, you need to use the Format event of the section that contains the
image control to assign its Picture property. Ultimately the line of code is
like this:
strFile = "C:\SomeFolder\SomeFile.gif"
Me.img1.Picture = strFile

In practice, there's a bit more to it than that, because you need to cope
with situations where:
a) your field is null (so there's no graphic to show), or
b) the file/path is no longer valid.
Hide the image control (Visible = False) if there's no graphic to show for
that record.
 

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