Image attachment

J

Jon

Hi guys,
I have a report with a picture box which dynamically accesses the image via
a text field using the following sub (which is an event procedure of the
detail bar)

Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
Dim filename As String
On Error GoTo nofilename
filename = "E:\My Documents\wholesale\catalogue\" & Me![imagename] & ".jpg"
Me![codepicture].Properties("Picture") = filename
Me![codepicture].Properties("visible") = True
Exit Sub
nofilename:
On Error Resume Next
Me![codepicture].Properties("visible") = False
End Sub

This method works fine for a few images, but I have 217 (its a catalog) and
the report generation is no longer smooth. Worse still, when I try to print,
the programme always bombs out at about record 50-70. Each image is between
50-90k.

Is there a way around this?
Is there a way to automatically bind the jpg image to the table as an ole
object based on the field "imagename", rather than manually selecting the
image for each record?

Thanks,

Jon
 
L

Larry Linson

I have a report with a picture box

Is it possible you mean an Image control? The code seems to fit, and, last
time I looked, Access does not have a "picture box" control (though classic
VB does).
. . . Worse still, when I try to print, the
programme always bombs out at about
record 50-70. Each image is between
50-90k.

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
 
L

Larry Linson

I appreciate your time.

You're welcome. I am glad I could be of help. Well, I'm glad that Stephen
could be of help -- he did all the "heavy lifting" on that one. <GRIN>
 

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