Inserting images into report on condition

A

accessforfootball

I am using Access 2003 to create scouting reports for my football team. On
the first page of the report, I'd like to insert the logo (.jpg or .bmp) of
the team we are playing that week. The remainder of the report is made up of
sub reports which ask which team to pull data on via parameter queries. Is
there any way to get this same sort of parameter type insert so I don't have
to go and insert it each week on my own or am I just better off doing it that
way.

Thanks in advance

Bryan
 
R

Rob Parker

Assuming that your main report is based on a query (presumably a parameter
query) which asks for the team:

1. Add a field for logo in your underlying teams table, and put the
folder/file name of each team's logo into that field. Include that field
(assume here that's you name it "Logo") in your query.

2. Add an image control to your report.

3. In the Format event of that section of the report containing the image
control, include the following code:
Me.imgControlName.Picture = Me!Logo

And that's it!

It's probably a good idea to add some error trapping (to at least cope with
nulls) to the code. You might need to change the Size Mode property for the
image control - Zoom will give a section of your image file (at its own
size) which matches the size of the image control; Stretch will fit the
image file to the control, expanding/shrinking horizontally and vertically
to suit (which may change the image proportion), and zoom will fit the image
without distortion (which may leave horizontal or vertical space in the
image control).

If you're wanting to include lots of images in a report, there are other
issues to be aware of. But for a single logo image this should be fine.

HTH,

Rob
 

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