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!

Access - Virtual memory loss when trying to print images

Status
Not open for further replies.

dapnee

Technical User
Sep 26, 2002
2
0
0
US
I have a database that contains a field that stores the path of a jpg image. I want to display the image in a report when it’s printed and I have the following event:

Private Sub Detail_Print(Cancel As Integer, PrintCount As Integer)
On Error Resume Next
Me![Image].Picture = Me![Photo_Path]
End Sub

This works fine except that the printing aborts after approximately 40 pages. I am getting a message that states that I am running out of virtual memory. I am running Windows XP and have plenty of hard disk space and about 256 Mb of RAM.

I have tried printing the report to a pdf as well as tried running from a higher end machine.

I noticed several posting similar to this one, but no one seems to have the problem of actually printing.

The images are jpg files and have been compressed.

I was hoping to use Crystal Report to solve this problem, but based on the postings, it appears that it is not possible to print images by retrieving them from a path statement.

Any help you can provide will be greatly appreciated.




 
Hello,

What version of Access are you using? Also, please describe the layout of images on your report. Are there multiple images being displayed/printed on a single report page?

I had some problems with images in Access 97 a couple of years ago. I ended up contacting MS Support with very little luck.

The problem has to do with how Access (and all windows programs) handle images. Even though your images are .jpg's, Access must convert them to .dib (Device Independant Bitmaps) in order to display or print them. The .dib format is very similar to the .bmp format. So, even though your image may be a 27Kb .jpg file, when converted in memory to a .dib, it is going to be between 900Kb and 1Mb. This typically only becomes and issue if you are displaying multiple pictures on a single report page. Access 97 & 2000 have an undocumented limit of 16Mb of .dib's per report page. I haven't checked if Access 2002 has increased this at all, but I doubt it has.

Now, in my 27Kb .jpg example, you have to realize that if you have a larger .jpg, then you have a larger .dib. If you have PaintShop Pro or some other image editing software that can convert from .jpg to .dib or .bmp you can test some of your files and see how large they are going to be in memory. (If you can't convert to .dib, just convert to .bmp since it will be a 99% accurate representation of the .dib size). Then, you must make sure that you aren't getting more than 16Mb of images on a report page.

Also, one other thing that can become an issue when working with a large report that has lots of images is the use of the [Pages] property on the report. If you have a "Page 1 of 39" type of thing on your report, then in order for Access to know that there are 39 pages, it has to actually produce your report all the way to the end, which means loading the entire report in memory. If you don't need to know that it is going to be 39 pages, then remove any references to the [Pages] property to avoid this. Then, when you print the report, Access in essence only has to generate and maintain one page in memory at a time.

My final solution was to use a third party ActiveX control that handles images. I chose ImageMan ActiveX control from Data Techniques
By using an external control to manage the display and sizing of images, I was able to get around the limit.
 
Thank you for your comments. I am on version 2002 and also experienced this problem on 2000. I also contacted MS Support when the problem was first encountered and did not have much luck.

I converted the jpg files to bmp. There are over 1,000 photos and growing. When the files were jpg, the folder was less than 200 Mb. In the bmp format, it takes up about 2.5 GB.

After converting to bmp and then taking your advise about the page numbers, I was able to increase the number of pages printed, but it still falls very short of the 300 plus pages in the document.

The layout of the report is fairly straight forward. There are anywhere from 1 to 4 pictures per page. The report is grouped by a category and by a sub category. the each item prints in alpha order based on its title. Each picture is an image about 1" square. It is to be filled in based on the actual image stored on the computer.

Is it difficult to learn the ImageMan ActiveX control...I'm not a programmer by definition, but I could probably be classified as an above average user with most applications?

I also understand that Stephen Lebans, MVP is working on some modifications to code at his site, to include the workaround for this problem. I have not seen anything there yet, but it might be worth watching.

Thank you.
Darla
 
When you say you get 300, do mean 300 images or pages

Alexander Jorge
City of Miami
Information System Analyst
[pc]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top