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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Prevent report fromm crashing? Large due to images

Status
Not open for further replies.

maclmu

IS-IT--Management
Mar 25, 2003
23
BE
Hi!

I have a problem with a picture database. The images are not embedded in the database but are linked dynamically.

I want to create a report with the database content. One record per page and two images per page.

The images are JPGs and approx. 4,5 MB each.

When i open/print the report, it is build by Access. The first ten pages are quite quick. Then the speed is decreasing constantly until the report breaks down at page 30 or so. In the task manager i can see 1,3 GB RAM getting freed upon the report termination.

Obviously Access is trying to build up the entire report in its memor. Which fail at some point.

Is there any way to prevent this error?

I have already created a copy of the report based on a query to reduce the amount of data. But that is impractible for the daily use.
 
How about using PrintOut as a work-around?
 
Could you be more specific, how that work around would be?

I have tried to print the report directly without opening its preview. I was hoping Access would free the memory of the already printed pages. But it does not. So the report keeps crashing.

This code will import the pictures:

Private Sub Detailbereich_Format(Cancel As Integer, FormatCount As Integer)
Me![Bild_1].Picture = CurrentProject.Path + Mid(Me![Bildname_1].Text, 2, Len(Me![Bildname_1].Text) - 1)
Me![Bild_2].Picture = CurrentProject.Path + Mid(Me![Bildname_2].Text, 2, Len(Me![Bildname_2].Text) - 1)
End Sub

Could i somehow resize the pictures upon loading?
 
I was thinking of something like:
Code:
DoCmd.OpenReport "rptReport", acViewPreview
MsgBox Reports("rptReport").Pages
For i = 1 To Reports("rptReport").Pages
DoCmd.PrintOut acSelection, i, i
Next
 
I tried it with the code you provided.

In this case Access will print out each page as seperate print. Which would be no problem.

But in order to do so, each time all pages up to the desired page are formated by Access. Thus resolving in the same crash.

What could help would be a report for each single record. Instead of invoking each page of the report.

But how do i do that?
 
You mention records, does each record have a unique ID? Could you say something like (?):
Code:
Set rs = CurrentDb.OpenRecordset("Select * From tblPictures")
Do While Not rs.EOF()
    DoCmd.OpenReport "rptReport", acViewDesign,, "ID=" & rs.ID
    rs.MoveNext
Loop
 
Thanks a lot!

It now prints the report page by page. Which is still a little bit uncomfortable. But at least i can print the report.

Page numbering will be done manually within the code.

Still i am curious what Microsoft will tell me about this.
 
Here are a few more notes.
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
From: Acces Report with Linked Pictures is Too Slow in Print Preview
thread703-856454



 
Mobing the code to the print section did not resolve the problem. Since Access still tries to load the entire report.

I have just implemented a button, printing out th whole thing page by page.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top