Inserting Images into a Report

G

Guest

My apologies if this has been asked before.

I have been tasked with developing a student admin database for our school.
The school has over 1000 students, each with their own photo.

I have 2 questions:
1. How can I insert a jpeg photo into a report for each student? I have
converted the jpegs to bmp and insert them fine, however the file size just
blows right up when I do this.

2. Given that I have solved question 1....how do I insert photos for over
1000 students easily? I couldn't imagine having to manually go through and
add each one as an OLE in the data table.

FYI....each student is identified by a unique ID (the primary key) and
photos of each student is sitting in a separate folder on my computer. The
photo name matches the students' ID (e.g Student with ID number 07001 has a
photo called "07001.jpg".

Any clues would be hugely appreciated.
 
C

Carl Rapson

Tonester said:
My apologies if this has been asked before.

I have been tasked with developing a student admin database for our
school.
The school has over 1000 students, each with their own photo.

I have 2 questions:
1. How can I insert a jpeg photo into a report for each student? I have
converted the jpegs to bmp and insert them fine, however the file size
just
blows right up when I do this.

2. Given that I have solved question 1....how do I insert photos for over
1000 students easily? I couldn't imagine having to manually go through and
add each one as an OLE in the data table.

FYI....each student is identified by a unique ID (the primary key) and
photos of each student is sitting in a separate folder on my computer.
The
photo name matches the students' ID (e.g Student with ID number 07001 has
a
photo called "07001.jpg".

Any clues would be hugely appreciated.

Howe about adding an Image control to your report Detail section, and in the
Detail_Format event do something like:

Me.imgPicture.Picture = "path to picture folder" & "\" & Me.ID & ".jpg"

Carl Rapson
 
G

Guest

Thanks, I'll give it a try. But I'm not liking my chances of getting it
right!!!

Could you clarify exactly where I would place this line??

Tony
 
C

Carl Rapson

In the Detail_Format event of the report. Open the report in Design view,
click on the header of the Detail section, open the Properties window, click
on the Event tab, select [Event Procedure] next to the On Format event, then
click on the small button with three dots next to that. A code window will
open and you can add the code to the pre-defined Detail_Format function.

Carl Rapson
 
L

Larry Linson

Tonester said:
My apologies if this has been asked before.

It was asked enough times before that several years ago, I created an
example database and made it available on the Internet. And, it's still
asked with some frequency... so don't feel as if you are the only one who
can't "figure it out on your own".
I have been tasked with developing a student
admin database for our school. The school has
over 1000 students, each with their own photo.

I have 2 questions:
1. How can I insert a jpeg photo into a report
for each student? I have converted the jpegs to
bmp and insert them fine, however the file size just
blows right up when I do this.

See the text below, beginning with "The sample imaging databases..." below.
It should help you... download it, read the brief article first, then look
at the example database. I really doubt that you want to insert the pictures
as OLE objects in your database.
2. Given that I have solved question 1....how do I insert
photos for over 1000 students easily? I couldn't imagine
having to manually go through and add each one as an
OLE in the data table.
FYI....each student is identified by a unique ID (the primary key) and
photos of each student is sitting in a separate folder on my computer.
The
photo name matches the students' ID (e.g Student with ID number 07001 has
a
photo called "07001.jpg".

Because you have an orderly naming scheme for the pictures, you should be
able to create VBA code to insert the path and file, or to retrieve them and
store them as BLOBs (see the download) in the database. If you aren't
comfortable with VBA code, either find a local Access contractor or post
back here, and maybe someone can assist you with various steps in the
process.

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
 

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