Dynamically Loading Images in a subreport

J

JCM

I have a report in which the Detail Section is made up of 15 subreports
linked based on an AssignmentID. One AssignmentID can create a report that
is 12 pages long. One of the subreports contains up to 12 Photos with 2 per
page. These Photos are stored in a subdirectory and are dynamically loaded.



In the Group Header (based on AssignmentID) of the main report I have an On
Format event to looks to see if Photos for this AssignmentID exists. If they
do, the subreport for the Photos is made visible else it is invisible. The
Photos Subreport consists of 3 sections (Report Header, Detail Section and
Report Footer, because of the Photos size (6" X 4.5") I can only put 4
photos in a section). I have a Procedure in the On Format event of the
Report Header of the Subreport that loads up to 12 photos (.jpg) into its
unbound image on the subreport.



Now the issue: When I run the report, it doesn't import the images on the
first page as expected (The group Header on the Main report). However, as
you preview or print the report you see it importing the images on the 2nd
to 5th pages that has subreports that do not contain images. You can also
see it importing the same images on the pages 6 and 7 first 2 pages of the
photos subreport. After that it doesn't go thru the import images until the
next Assignment ID even though there might be more pages of images. (You can
see the "import dialog" box as they come in.).



I assumed that the images would have been imported one time. The on format
event of the header of the subreport that loads the photos only would be
executed once for each assignment ID. Obliviously that is incorrect. On what
event would it be more appropriate to load the images and have it execute
once per assignment ID. In a few instances with large photos the computer
runs out of memory importing them on the second or third pass on the same
Assignment ID.



Thanks

Johnny
 
S

Stephen Lebans

Use the Print event.
Turn off the "loading Image" dialog.

Here is a prior post of mine on this issue:

The one thing you must do is turn of the "Loading Image" dialog. If you
don't,
and quickly scroll through the records in Form view, or page quickly in
Print Preview, you run the risk of crashing Access. Use the Registry mod at
the Access MVP site:


Additionally, two issues in regards to the Registry modification pointed to
here:


http://www.mvps.org/access/api/api0038.htm


1) The Registry key MUST be "No" NOT "no" or "NO"


2) On systems with XP or on systems with more than one user account,
you must add/modify the key in both HKEY_CURRENT_USER and
HKEY_LOCAL_MACHINE.


--

HTH
Stephen Lebans
http://www.lebans.com
Access Code, Tips and Tricks
Please respond only to the newsgroups so everyone can benefit.
 
J

JCM

Thanks for the tip.

I could not use the on Print event since I was dynamically changing the
sizes of the sections and images however it lead me to a solution to test
for the assignment number and only process the images once for that
assignment number in the on format event.

I also turned off the Load Image dialog after proving that I only load the
images once.

Thanks again
 

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