Graphic Images in Access Reports
Add Large Graphic Images Into a Report at Run-Time
Have you ever tried to produce a Microsoft Access report that has a complex government or state form overlaid as a image
on which you place the data/text fields?
We have dozens of downloadable Access small business databases for you to learn and examine.
With our new partnership with IT Impact we have extensive programming support in SQL/Server database, MS Access software, Power BI applications, .Net web development, PHP, Excel & Outlook customization.
If you have had my experience
you find that a few 100 kilobytes jpeg image turns into 30 megabytes when inserted
into an Access report. If you have several of these jpg images then soon
your database grows to 100's of megabytes in size and gets slow and fragile.
The trick is to dynamically overlay graphic images at runtime. To do this you'll need to line up the data
fields using a temporarily inserted picture as shown below:
Important points are to get the size of the image just right so that it is not
too large for the paper. Before resizing you must change the Size Mode
Property from Clip to Zoom otherwise the image will get distorted. Once
the picture is sized to fit on the paper then we overlay the data fields on to
the image at the appropriate locations. Note that it is best to change
the Back Style property of the text fields from Normal to Transparent.
This will make it so the text fields won't obscure part of the form such as
the underline in the Name / Address fields.
The next step is to remove the picture - but don't delete it. Change the Picture Property from the location
of the form's image to blank (delete the entry). Access will change this field to (none).
Now, the final step is to write a little bit of VBA code so that the image
will be inserted into the report at time of printing:
Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
Me.Form_Image.Picture = "c:\access 2000\santen.jpg"
Note that this is event is the Format event of the Detail section.
Now, when the report is run you get the form image dynamically inserted
into the report:
With this technique your database will not bloat up to 100's of megabytes.