Images in Reports

  • Thread starter Thread starter Amy
  • Start date Start date
A

Amy

Hello all,

I'm organising a valentines dinner for the local Rotary club, and
the time has come to start doing the table plan. Oh joy.

I want to create a report that lists everyone's names (with table
numbers etc. but that's not important), next to all the "guests" I want my
'guest' image (a rose in this case), next to all the rotarians I want my
rotary image.

Now I could upload an image for ever single person I enter into the
database (Insert Menu - Object - select the file, click ok) but that'll take
forever. So, my quesiton, is there a way, on my report of saying

If current person status = Rotarian then
Show Rotary Image
Else if current person status = Guest then
Show Guest image
end if

And if so, how and where???? anyone?

Do I need to create a new image table:

Status Imagefile
-------------------------------------
Guest (get guest image)
Rotarian (get rotarian image)
Important (important looking image)

Etc etc

Then reference that from the report?

Any ideas please :-)

Amy K
 
Amy,

In your report add an image control (you will need to
point this control at an image file, so point it any old
image eg. c:\pics\default.bmp for now). In your guest
table add a field (text 50 characters should do). In here
store the full path and extension to the respective image
you want for the guest. An update query could speed this
up. This field will be used to set the picture property on
your report's image.

Assuming the image is in the "detail section" of your
report (substitute the appropiate section). In the "On
Format" event for the detail section (look in properties
for the section) add the following code:

dim picpath as string
picpath = [image path] 'the field name you added earlier
[image control name].picture = picpath

This will set the picture to whatever picture is entered
in the field for each guest.

A few notes:
If the report is large (say over 500-1000 records) I would
look at converting the images to bmp files which will
allow the report to scale much better (around 10,000 pages
I still have problems with bitmaps).
The other image properties may need a bit of tweaking such
as size mode and alignment to get the look you want.
Most image formats will display using the office graphic
filters .... I have heard of problems with runtime
versions..... if in doubt use bitmaps.

HTH,

Terry
 
Thank you :-) That's great.

I was moving in the right direction, but now I know where to start from!

Amy - off to make many, many reports in glorious Technicolor!

Terry said:
Amy,

In your report add an image control (you will need to
point this control at an image file, so point it any old
image eg. c:\pics\default.bmp for now). In your guest
table add a field (text 50 characters should do). In here
store the full path and extension to the respective image
you want for the guest. An update query could speed this
up. This field will be used to set the picture property on
your report's image.

Assuming the image is in the "detail section" of your
report (substitute the appropiate section). In the "On
Format" event for the detail section (look in properties
for the section) add the following code:

dim picpath as string
picpath = [image path] 'the field name you added earlier
[image control name].picture = picpath

This will set the picture to whatever picture is entered
in the field for each guest.

A few notes:
If the report is large (say over 500-1000 records) I would
look at converting the images to bmp files which will
allow the report to scale much better (around 10,000 pages
I still have problems with bitmaps).
The other image properties may need a bit of tweaking such
as size mode and alignment to get the look you want.
Most image formats will display using the office graphic
filters .... I have heard of problems with runtime
versions..... if in doubt use bitmaps.

HTH,

Terry
-----Original Message-----
Hello all,

I'm organising a valentines dinner for the local Rotary club, and
the time has come to start doing the table plan. Oh joy.

I want to create a report that lists everyone's names (with table
numbers etc. but that's not important), next to all the "guests" I want my
'guest' image (a rose in this case), next to all the rotarians I want my
rotary image.

Now I could upload an image for ever single person I enter into the
database (Insert Menu - Object - select the file, click ok) but that'll take
forever. So, my quesiton, is there a way, on my report of saying

If current person status = Rotarian then
Show Rotary Image
Else if current person status = Guest then
Show Guest image
end if

And if so, how and where???? anyone?

Do I need to create a new image table:

Status Imagefile
-------------------------------------
Guest (get guest image)
Rotarian (get rotarian image)
Important (important looking image)

Etc etc

Then reference that from the report?

Any ideas please :-)

Amy K



.
 
Terry you do not have to convert and store your Images to Bitmaps. The
conversion can be done at runtime prior to loading the file into the
Image control. See:
http://www.lebans.com/image_faq.htm#Convert all Images to Bitmap
%20in%20Reports%20at%20runtime
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.


Terry said:
Amy,

In your report add an image control (you will need to
point this control at an image file, so point it any old
image eg. c:\pics\default.bmp for now). In your guest
table add a field (text 50 characters should do). In here
store the full path and extension to the respective image
you want for the guest. An update query could speed this
up. This field will be used to set the picture property on
your report's image.

Assuming the image is in the "detail section" of your
report (substitute the appropiate section). In the "On
Format" event for the detail section (look in properties
for the section) add the following code:

dim picpath as string
picpath = [image path] 'the field name you added earlier
[image control name].picture = picpath

This will set the picture to whatever picture is entered
in the field for each guest.

A few notes:
If the report is large (say over 500-1000 records) I would
look at converting the images to bmp files which will
allow the report to scale much better (around 10,000 pages
I still have problems with bitmaps).
The other image properties may need a bit of tweaking such
as size mode and alignment to get the look you want.
Most image formats will display using the office graphic
filters .... I have heard of problems with runtime
versions..... if in doubt use bitmaps.

HTH,

Terry
-----Original Message-----
Hello all,

I'm organising a valentines dinner for the local Rotary club, and
the time has come to start doing the table plan. Oh joy.

I want to create a report that lists everyone's names (with table
numbers etc. but that's not important), next to all the "guests" I want my
'guest' image (a rose in this case), next to all the rotarians I want my
rotary image.

Now I could upload an image for ever single person I enter into the
database (Insert Menu - Object - select the file, click ok) but that'll take
forever. So, my quesiton, is there a way, on my report of saying

If current person status = Rotarian then
Show Rotary Image
Else if current person status = Guest then
Show Guest image
end if

And if so, how and where???? anyone?

Do I need to create a new image table:

Status Imagefile
-------------------------------------
Guest (get guest image)
Rotarian (get rotarian image)
Important (important looking image)

Etc etc

Then reference that from the report?

Any ideas please :-)

Amy K



.
 
Back
Top