bound object frame: picture

  • Thread starter Thread starter Bob
  • Start date Start date
B

Bob

I am trying to use the command dialog box to select a bmp file while
entering data about a customer. I would like to associate a picture with a
first/last name like in the Northwind sample. Were could I find a good
example. ?
Thanx
 
I am trying to use the command dialog box
to select a bmp file while entering data about
a customer. I would like to associate a picture
with a first/last name like in the Northwind
sample. Were could I find a good example. ?

The sample imaging databases at http://accdevel.tripod.com illustrate three
approaches to handling images in Access, and the download includes an
article discussing considerations in choosing an approach. Two of the
approaches do not use OLE Objects and, thus, avoid the database bloat, and
some other problems, associated with images in OLE Objects.

If you are printing the images in reports, to avoid memory leakage, you
should also see MVP Stephen Lebans' http://www.lebans.com/printfailures.htm.
PrintFailure.zip is an Access97 MDB containing a report that fails during
the Access formatting process prior to being spooled to the Printer Driver.
This MDB also contains code showing how to convert the contents of the Image
control to a Bitmap file prior to printing. This helps alleviate the "Out of
Memory" error that can popup when printing image intensive reports.

Larry Linson
Microsoft Access MVP
 
I sent this yesterday -- but it was not posted, so I will try again
2-19-200
Bob
I hope you get an answer to your question

I have been trying to get an answer on the same basic subject for about two months now

Warning: If you follow the Northwind sample an link the pictures, your entire database will stop working when you get about 100 pictures 'linked'. The error message is "Database has reached maximum size"
In Access97 this is 1GB, Access 2000 2GB (200 pictures)

I thought 'linking' would keep the photo 'out of the database' However, this is what I have learned
"...., as well as 'linking' to the original file, a 'Preview' image is stored in the database. Since this image is uncompressed it can be up to 100 times the size of the original image file (or more), hence the problem you are seeing.

I have tried splitting the database, linking tables from additional databases, and finally not linking the photos but only storing the text description of the path to the photo file in the database (as suggested by all the 'experts'). This works okay in 'FORMS', but when trying to view or worse yet print a REPORT, the database locks up and 'times-out' while attempting to format the reports with the pictures

This is a link to the MS solution (Works with the results I described above)

http://support.microsoft.com/default.aspx?scid=kb;en-us;21010

Here are the subjects of the 'threads' I have posted on this forum (I am trying some others as well)
How do I correctly write this expression
Photo Path
LoadSaveJpe

Best of luck - (maybe no photo?
Ro
 
Ron if you have spent two months with this issue then I would suggest
that you need to go back and revisit the suggestions given to you
earlier. THis should have been a one day issue at most.

Keeping the Images in a folder instead of the MDB is certainly the
suggested course of action. Since you are still using Access97, which is
now 3 full versions out of date, you have to expect you may run into the
type of memory/resource issue you are encountering.

Here are some steps you must follow to eliminate/reduce the error you
are encountering:
1) Defrag your Hard drive. The temp printer output files Access
generates can be very large when they contain images.
2) Make sure the drive you point your Virtual Memory Manager to has
several hundred MB's of free space.
3) If you are still using Win9x then make sure you reboot before
printing.
4) You must turn off the "Loading Image" dialog via the Registry
solution here:
http://www.mvps.org/access/api/api0038.htm
5) Load the Images into the Image control from the Detail Section's
Print event NOT THE FORMAT EVENT.


If you follow the above steps and your Report still fails then here are
a couple of more solutions:

1) Upgrade to the latest version of Windows at the very least. Better
yet, upgrade to Access 2003 as well.
or
2) Use the PrintOUt method to only print out a limited number of pages
at a time. Repeat as required.
or
3) THis solution seems to look after most of the memory issues. At
runtime convert the Images to Bitmap format prior to loading them into
the Image control. Here is some sample code:


From: Stephen Lebans ([email protected])
Subject: Re: Images in Reports
View: Complete Thread (18 articles)
Original Format
Newsgroups: microsoft.public.access.reports
Date: 2002-09-16 18:46:39 PST


Bruce I finally got a chance to test your method last night. It helped
but only with the actual printing and not the Print Preview itself.
I was able to print the failed Report directly to the printer or to a
disk printer file so that's great! Don't get me wrong, it's still a good
thing because at least you can print the report!

Unfortunately Acess still runs out of resources when you page back and
forth through Print Preview.
I plan to spend some time onthis issue shortly.
Here is the code I use to convert any Jpeg, Gif, or Metafile into a BMP.
Rather than using one of my API solutions I have cheated and set a
Reference to Standard OLE Types type library in order to get at the
SAVETODISK method. But no ActiveX controls are required


Private Sub Detail_Print(Cancel As Integer, PrintCount As Integer)

Private ctr As Long

ctr = ctr + 1

Select Case ctr
Case 1
Me.Image10.Picture = CreateBitmapFile("C:\A.jpg")

Case 2
Me.Image10.Picture = CreateBitmapFile("C:\b.jpg")

Case 3
Me.Image10.Picture = CreateBitmapFile("C:\c.jpg")
ctr = 0

Case Else
ctr = 0

End Select

End Sub

Private Sub Report_Open(Cancel As Integer)
ctr = 0
End Sub


Private Function CreateBitmapFile(fname As String) As String

Dim obj As Object

Set obj = LoadPicture(fname)
If Not IsNull(obj) Then

SavePicture obj, "C:\SL11-52"
DoEvents
End If


CreateBitmapFile = "C:\SL11-52"
Set obj = Nothing

End Function



--

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


NMex Ron said:
I sent this yesterday -- but it was not posted, so I will try again:
2-19-2004
Bob,
I hope you get an answer to your question.

I have been trying to get an answer on the same basic subject for about two months now.

Warning: If you follow the Northwind sample an link the pictures,
your entire database will stop working when you get about 100 pictures
'linked'. The error message is "Database has reached maximum size".
In Access97 this is 1GB, Access 2000 2GB (200 pictures).

I thought 'linking' would keep the photo 'out of the database'
However, this is what I have learned:
"...., as well as 'linking' to the original file, a 'Preview' image is
stored in the database. Since this image is uncompressed it can be up
to 100 times the size of the original image file (or more), hence the
problem you are seeing."
I have tried splitting the database, linking tables from additional
databases, and finally not linking the photos but only storing the text
description of the path to the photo file in the database (as suggested
by all the 'experts'). This works okay in 'FORMS', but when trying to
view or worse yet print a REPORT, the database locks up and 'times-out'
while attempting to format the reports with the pictures.
This is a link to the MS solution (Works with the results I described above):

http://support.microsoft.com/default.aspx?scid=kb;en-us;210100

Here are the subjects of the 'threads' I have posted on this forum (I
am trying some others as well):
 
Stephan

Please let me respond to your critique and hopefully help Bob along the way
First, thanks for your response to these comments

Please read on to your suggestion number 5, were you will find my hooray that you have solved my problem!! However, please give us suggestions on your point number 4 (changing the registry OR ‘Suppress the "Loading Image" dialog’

Thanks a million
Ro

Bob – best of success in your picture adventure

----- Stephen Lebans wrote: ----
Ron if you have spent two months with this issue then I would sugges
that you need to go back and revisit the suggestions given to yo
earlier. THis should have been a one day issue at most

I would have loved to have solved this issue in one day. I have attempted to apply all the suggestions that you and others gave. Some of the suggestions were undoubtedly beyond my limited understanding of coding. I am a rancher and a retailer, not a database expert
Keeping the Images in a folder instead of the MDB is certainly th
suggested course of action. Since you are still using Access97, which i
now 3 full versions out of date, you have to expect you may run into th
type of memory/resource issue you are encountering

Is the latest version of Access improved in this area - other than than offering 2MB of space?
Here are some steps you must follow to eliminate/reduce the error yo are encountering
1) Defrag your Hard drive. The temp printer output files Acces
generates can be very large when they contain images

I regularly defrag my hard drives
2) Make sure the drive you point your Virtual Memory Manager to ha
several hundred MB's of free space

I allow WindowsXP to manage the memory allotted, and the 20GB hard drive I use has 8 GB of free space
3) If you are still using Win9x then make sure you reboot befor
printing
I use MS WindowsX
4) You must turn off the "Loading Image" dialog via the Registr
solution here
http://www.mvps.org/access/api/api0038.ht
I did change the registry entry to NO and it did not change anything (sure wish you could give further advice on this)
HKEY_LOCAL_MACHINE\Software\Microsoft\ Shared Tools\Graphics Filters\Import\JPEG\Option
Change the ShowProgressDialog key value to "No"
5) Load the Images into the Image control from the Detail Section'
Print event NOT THE FORMAT EVENT

This is hopefully the MOST important thing I have learned in this discussion.
THIS FIXED MY PROBLEM!!!!! The slow scrolling through every picture and the slow printing problem is fixed!!!!!!!!!!!!


If you follow the above steps and your Report still fails then here ar
a couple of more solutions

1) Upgrade to the latest version of Windows at the very least. Bette
yet, upgrade to Access 2003 as well
o
2) Use the PrintOUt method to only print out a limited number of page
at a time. Repeat as required
o
3) THis solution seems to look after most of the memory issues. A
runtime convert the Images to Bitmap format prior to loading them int
the Image control. Here is some sample code


From: Stephen Lebans ([email protected]
Subject: Re: Images in Report
View: Complete Thread (18 articles
Original Forma
Newsgroups: microsoft.public.access.report
Date: 2002-09-16 18:46:39 PS


Bruce I finally got a chance to test your method last night. It helpe
but only with the actual printing and not the Print Preview itself
I was able to print the failed Report directly to the printer or to
disk printer file so that's great! Don't get me wrong, it's still a goo
thing because at least you can print the report

Unfortunately Acess still runs out of resources when you page back an
forth through Print Preview
I plan to spend some time onthis issue shortly
Here is the code I use to convert any Jpeg, Gif, or Metafile into a BMP
Rather than using one of my API solutions I have cheated and set a
Reference to Standard OLE Types type library in order to get at the
SAVETODISK method. But no ActiveX controls are required


Private Sub Detail_Print(Cancel As Integer, PrintCount As Integer)

Private ctr As Long

ctr = ctr + 1

Select Case ctr
Case 1
Me.Image10.Picture = CreateBitmapFile("C:\A.jpg")

Case 2
Me.Image10.Picture = CreateBitmapFile("C:\b.jpg")

Case 3
Me.Image10.Picture = CreateBitmapFile("C:\c.jpg")
ctr = 0

Case Else
ctr = 0

End Select

End Sub

Private Sub Report_Open(Cancel As Integer)
ctr = 0
End Sub


Private Function CreateBitmapFile(fname As String) As String

Dim obj As Object

Set obj = LoadPicture(fname)
If Not IsNull(obj) Then

SavePicture obj, "C:\SL11-52"
DoEvents
End If


CreateBitmapFile = "C:\SL11-52"
Set obj = Nothing

End Function



--

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

============================================
NMex Ron said:
I sent this yesterday -- but it was not posted, so I will try again:
2-19-2004
Bob,
I hope you get an answer to your question.
your entire database will stop working when you get about 100 pictures
'linked'. The error message is "Database has reached maximum size".
In Access97 this is 1GB, Access 2000 2GB (200 pictures).
However, this is what I have learned:
"...., as well as 'linking' to the original file, a 'Preview' image is
stored in the database. Since this image is uncompressed it can be up
to 100 times the size of the original image file (or more), hence the
problem you are seeing."databases, and finally not linking the photos but only storing the text
description of the path to the photo file in the database (as suggested
by all the 'experts'). This works okay in 'FORMS', but when trying to
view or worse yet print a REPORT, the database locks up and 'times-out'
while attempting to format the reports with the pictures.am trying some others as well):
 
Ron I'm glad you are making progress with your issue. It's always a
steep learning curve to begin with!

The Registry solution has always worked 100% of the time until
NT/WIn2K/XP. Now you have to modify the relevant keys in both:
HKEY_LOCAL_MACHINE
HKEY_CURRENT_USER

I still cannot get it to work though on my Win2K installation without
having to make the modification to the HK_USERS as well. It must have
something to do with how you logon.

Well that's three seperate places to make my Win2K machine work...but it
does work.

--

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


NMex Ron said:
Stephan,

Please let me respond to your critique and hopefully help Bob along the way.
First, thanks for your response to these comments.

Please read on to your suggestion number 5, were you will find my
hooray that you have solved my problem!! However, please give us
suggestions on your point number 4 (changing the registry OR
â?~Suppress the "Loading Image" dialogâ?T.
Thanks a million!
Ron

Bob â?" best of success in your picture adventure.

----- Stephen Lebans wrote: -----
suggest
that you need to go back and revisit the suggestions given to you
earlier. THis should have been a one day issue at most.

I would have loved to have solved this issue in one day. I have
attempted to apply all the suggestions that you and others gave. Some
of the suggestions were undoubtedly beyond my limited understanding of
coding. I am a rancher and a retailer, not a database expert.
the
suggested course of action. Since you are still using Access97, which is
now 3 full versions out of date, you have to expect you may run into the
type of memory/resource issue you are encountering.

Is the latest version of Access improved in this area - other than than offering 2MB of space?
error you
are encountering:
generates can be very large when they contain images.

I regularly defrag my hard drives.
has
several hundred MB's of free space.

I allow WindowsXP to manage the memory allotted, and the 20GB hard
drive I use has 8 GB of free space.
printing.
I use MS WindowsXP

solution here:
http://www.mvps.org/access/api/api0038.htm
I did change the registry entry to NO and it did not change anything
(sure wish you could give further advice on this):
HKEY_LOCAL_MACHINE\Software\Microsoft\ Shared Tools\Graphics Filters\Import\JPEG\Options
Change the ShowProgressDialog key value to "No".
Section's
Print event NOT THE FORMAT EVENT.

This is hopefully the MOST important thing I have learned in this discussion.
THIS FIXED MY PROBLEM!!!!! The slow scrolling through every picture
and the slow printing problem is fixed!!!!!!!!!!!!!
 
Stephan

I did the change in
HKEY_CURRENT_USE
and that fixed it - The data base and pictures just Screeeeeeeeeem through the records now

The Cows are happy and so am I - now I can focus more on the fence fixing and other projects around the ranch

Bob should be able to get his photos going with this information

Stephan - Thanks again for all your help
-- -- -- -- -- -- -- --
Bob -- if you have any trouble please send me an email - I think I can give you a fairly quick summary of what I now have in place that works


----- Stephen Lebans wrote: ----

Ron I'm glad you are making progress with your issue. It's always
steep learning curve to begin with

The Registry solution has always worked 100% of the time unti
NT/WIn2K/XP. Now you have to modify the relevant keys in both
HKEY_LOCAL_MACHIN
HKEY_CURRENT_USE

I still cannot get it to work though on my Win2K installation withou
having to make the modification to the HK_USERS as well. It must hav
something to do with how you logon

Well that's three seperate places to make my Win2K machine work...but i
does work
 
Back
Top