Using VBA - insert image box in report when image exists in record

ksimpson61

Registered User.
Local time
Today, 08:12
Joined
Sep 8, 2016
Messages
36
I have a sub report that is used only to display either one or two images for the selected record. Each image fills a full page. It worked great when I only had one image except that if a particular record does not have an image, there is one blank page in the report. But adding the second image has caused further blank space. This is especially annoying since most of the records only have one image. There is no way to shrink an image box in a report and shrinking the detail or the sub report doesn't work as the image box is still holding the space. I would like to be able to insert the image boxes as the report is being formatted only if the record has image paths in the fields for that particular record.
 
Set the height of your subreport in the parent report very small and set the properties of the subreport object in the parent report CanGrow to yes.
 
That's what I have and it doesn't work. That's why I thought I could call in the image box at the time the report is being formatted...setting the size of the image box at the time so that it isn't already established in the sub report.
 
Do you have a page break before the subform? If so, test in the onFormat event if there is an image, and set the page break control's visible property to true or false accordingly.
 
Use the OnFormat event of the section (eg Report detail) where the page break is located.

If you are still unsure, paste your report into a new database and post that.
 
I understand. The page break isn't the issue as there is mostly always a first image, so I need to keep the sub report visible. It is the second image that only applies to a few records, but I have to include the second image box in the sub report in case there is one. Maybe I can try to merge the two images into one image box.
 

Users who are viewing this thread

Back
Top Bottom