Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Acces Report with Linked Pictures is Too Slow in Print Preview 3

Status
Not open for further replies.

wirelessben

Programmer
Mar 23, 2004
20
0
0
US
I have an Access report of 500 records with linked pictures for each record. Each page shows 8 records. The report takes 6 minutes to Print Preview. It used to take 3 seconds when the pictures were stored inside the database. The database is 95% smaller now, but my report is takes way too long to print preview.

The pictures are 1"X1" jpegs averaging 15K. I use an image control with a VB event procedure to display the pictures on detail_format.

The underlying query is simple and does not reference the picture at all. The picture is named the same as the record ID number plus the ".jpg" extension, e.g. AA001.jpg.

Access is definitely loading the entire report before displaying the first page, because it displays 500 progress bars for importing each linked picture.

How can I speed it up?

Interesting fact: when the pictures were stored inside the database, clicking the Last Record button on the record navigator also took six minutes. Access seems to load the entire report in that case, but not when specifying a page number, as in the first page.
 
When the report is linked to the pics in your computer and you run Print Preview ACCESS runs through the entire datafile and prepares the entire report before the displaying. I don't think there is anything that can be done other than being selective with the records to be printed. If you setup a form to select a participle product or category then the report can run through the Print Preview quicker. I don't know the type of data or pics here but if it is important to view records before printing then the use a selection process to par down the database recordset would be the only way to go.

Post back if this idea makes sense in your situation.

[COLOR=006633]Bob Scriver[/color]
MIState1.gif
[COLOR=white 006633]MSU Spartan[/color]
 
Bob,

The star is for the information and you coming up on the two year anniversary of your other now-famous thread on this topic. Congratulations.

The problem remains, however: why would Access load a 500 record embedded picture Print Preview in 3 seconds when the same database using linked pictures takes 6 minutes?

Why can't Access let me see just the first page in Print Preview as it appears to do with embedded pictures?

It is important to see the entire 500 records at one time, and I really don't wish to rewrite the Access report engine just to display 1 page at a time. :)

Thank you for your valuable time.

Ben
 
Hello Ben: Thanks for the comments on the Picture in My Report thread. Can you believe the workout that it has gotten over the last two years. I really do love working in that one.

As for your report. It is logical that the embedded report will open in preview right away because all the data for the report is already there. In the linked report ACCESS must run the entire report and link all of the pictures before it displays the first page.

The Format event occurs when Microsoft Access determines which data belongs in a report section, but before Microsoft Access formats the section for previewing or printing.

The above quote is from ACCESS Help - On Format section. ACCESS makes multiple passes through the report creation to execute all the code and prepare the report for previewing and printing. It is for this reason that you see the slow setup time for the linked report. It can't display the first page until it has formated the last page. Part of the formatting process is bringing in the picture images to the controls and setting up the formatted page structure.

I hope that this helps you with your report. I will continue to think of ways to speed it up for you. Did the category selection process make sense to you? If there is a way to identify the data you want to look at maybe you can do it by selecting a particular group and only loading those records.

Let me know if you come up with any new ideas here.

[COLOR=006633]Bob Scriver[/color]
MIState1.gif
[COLOR=white 006633]MSU Spartan[/color]
 
Bob,

I guess my only possible option is to use an event procedure with the OpenReport and PrintOut actions inside a loop that can track which page the user wants and only print preview that page.

I am a soldier in Afghanistan doing this report for their national army, so I appreciate your help with the peace effort in the middle of the desert! I'm 8.5 hours ahead of you, so I have to hit it.

I'll check in the morning for new developments. Go Fightin' Irish!

Ben
 
I am humbled by your dedication and willingness to do what you do each day. We here in the States all thank you and your fellow soldiers for keeping our world safe from terrorists. Keep up the good work and I will surely see if I can figure out a better way for you to print preview this report. Get back with me with as much specifics as you can about the selection process that you need and I will try to accommodate.

Regards and stay safe.

[COLOR=006633]Bob Scriver[/color]
MIState1.gif
[COLOR=white 006633]MSU Spartan[/color]
 
Bob,

I cheated and got around the problem by not showing pictures in Print Preview. It's not ideal, but its better than waiting 6 minutes.

The data is of a battalion of soldiers (500 guys) organized into five companies. The printout is used as a pay roster. I can show just one company at a time, but that breaks up the pay roster. I might just try printing 1 page at a time inside a loop.
 
What about the size of the images. If you are using a high quality picture you may be able to reduce the size/quality of the picture but still have a good image and get the report to load quicker.

Why is it that you want to perform the print preview before the actual printing? This is the step that I don't understand. Is it that you want the paymaster or someone to be able to bring up the report quickly and see it before printing? Confusing to me. If you go directly to print without the preview you would never notice the delay.

[COLOR=006633]Bob Scriver[/color]
MIState1.gif
[COLOR=white 006633]MSU Spartan[/color]
 
The report shows how much money each soldier is due for the month.

The paymasters use the report to determine how much money to draw for the battalion, so it has to be accurate. They like to Print Preview it so they don't waste 30 minutes and 70 sheets of paper printing an inaccurate pay roster.

 
Ben,

Would it be possible to utilize a form to lookup the soldier or scroll through the battalion, displaying their information along with photo, instead of the report??

Hoc nomen meum verum non est.
 
CosmoKramer is correct. A form with a Subform with each record and a picture could do the job for you. All of the totals and such could also be displayed for verification of amounts.



[COLOR=006633]Bob Scriver[/color]
MIState1.gif
[COLOR=white 006633]MSU Spartan[/color]
 
Cosmo,

I have a similar form with pictures from the database itself and it is agonizingly slow to scroll. I can't imagine linked pictures being faster.

Thanks for the suggestion, though.

Ben
 
How about not showing the pictures in the subform unless they need to see it. The Totals and such would be there and if they need to view a picture a button on the subform's continous form could be clicked and have the picture show up on the mainform. I say the main form because we don't want to have to deal with the same picture at each subform record. They can review the data below in the subform and if necessary see the soldier in the picture control above on the main form area.

[COLOR=006633]Bob Scriver[/color]
MIState1.gif
[COLOR=white 006633]MSU Spartan[/color]
 
I like the idea. I'll just replace the picture with an icon that says "Click here to see picture". I'll add logic to only use the real picture when printing.

Thanks, Bob and Cosmo. This is a good solution. I appreciate your help. You've done your part for the war effort today.
 
Good luck and stay well. Tell the guys that we are all very proud of them. Anything we can do please feel free to contact us back.

[COLOR=006633]Bob Scriver[/color]
MIState1.gif
[COLOR=white 006633]MSU Spartan[/color]
 
This story has a much happier ending, as I have found a perfect solution.

Remember what I wrote in the original post about displaying the pictures on detail_format? Well, that's a very bad technique, as it causes Access to load the whole 70 page report before displaying the first page. Plus, it takes up 800 Megs of memory. Thumbs down all around.

Thanks to Klaus Oberdalhoff's Use Pics download from 4 May 1999 at the Access Web, he showed that the image loading code I had in the detail_format section should be moved to the detail_print procedure, as so:

Private Sub Detail_Print(Cancel As Integer, PrintCount As Integer)
On Error Resume Next
Me!imgSoldier.Picture = Me!txtPath & Me!txtFileName
End Sub

The report now previews in 5 seconds instead of 6 minutes.

To suppress the loading JPEG progress bar, edit the following registry key:
HKEY_LOCAL_MACHINE\Software\Microsoft\Shared Tools\Graphics Filters\Import\JPEG\Options

WirelessBen
 
Wireless: I have given you a Star for this final posting. Great technique and info that should be noted. Thanks for posting back with this new information about a subject that many are so interested in. I will provide a link to this thread in another thread that deals with Pictures in Reports.

Pleased to see that you are well in these dangerous times.

[COLOR=006633]Bob Scriver[/color]
MIState1.gif
[COLOR=white 006633]MSU Spartan[/color]
 
Bob,
I too have greatly appreciated your information on using images in access. I have a database that uses a few images when it prints a report....I have never been able to suppress the "importing images" blue bar that appears on the screen when you hit my "print" button. I was hoping wirelessben's editing method would work on the registry, but I haven't been able to make that work. I still get the importing message after editing the registry key to "no" on the showdialog key. I even tried Dev Ashish's method of suppressing the Print dialog with a timer event and a loaded hidden form. That did reduce the print dialog box, but the importing message still appeared for every record that had an image. I wonder if you had tried the registry edit method and got it to work. Maybe wirelessben can let me know if I'm just missing something. The importing message is not a real pain...but it doesn't make for a very "clean" looking application. Thanks for any advice.
Doc
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top