Pictures in a continuous report

  • Thread starter Thread starter Paradigm
  • Start date Start date
P

Paradigm

I have a data table and store the paths to pictures in it. I need to display
some of the data and the picture in a continuous report. I have tried
setting the picture property in the onprint and onformat events of the
report detail section but neither seem to work. The onformat option seems to
load all the pictures and then display the last one for all records. The
onprint option seems to load the first picture and then display that for all
records.
Is there any way of doing this.
I could design a report with a set number of records on it and then somehow
code each page separately but with report header/footers and page header
this seems to be a ridiculous complication.
Alec
 
I'm not really sure where you are going wrong, but the following code is from
a report's module which does this. The report is opened maximized in print
preview. ImagePath is a hidden control in the report's detail section bound
to a column in the table which stores the full paths to the image files.
Image1 is an Image control in the report's detail section

Option Compare Database
Option Explicit

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

If Not IsNull(Me.ImagePath) Then
Me.Image1.Picture = Me.ImagePath
Me.Image1.Visible = True
Else
Me.Image1.Visible = False
End If

End Sub


Private Sub Report_Close()

DoCmd.Restore

End Sub

Private Sub Report_NoData(Cancel As Integer)

MsgBox "No data to report", vbInformation, "Images"
Cancel = True

End Sub

Private Sub Report_Open(Cancel As Integer)

DoCmd.Maximize

End Sub

Note that if you are using JPEGs you can suppress the progress meter which
pops up when each image is loaded by a registry hack, details of which can be
found at:


http://www.mvps.org/access/api/api0038.htm


Ken Sheridan
Stafford, England
 
Does this code work with a continuous report i.e. where there are multiple
records and therefore multiple images on the same page?
Alec
 
Alec:

Yes; that's exactly the context in which its used. While there is no
problem with a report, you cannot use this approach to display images in a
continuous form, only in a continuous form as when the path is assigned to
the Picture property of an image control in a continuous form it shows as the
image in every record. Its fine with a form in single form view, however,
where the Current event procedure is used to assign the path to the control's
Picture property.

Incidentally I also have a report design which prints multiple images per
record by means of a subreport. You'll find my demo file which does this at
the following link. In the forms in the demo it works in a rather different
way, with a list box on the form enabling one or more images associated with
each record to be selected for viewing in another form where each image can
be opened via a hyperlink.


http://community.netscape.com/n/pfx...yMessages&tsn=1&tid=23913&webtag=ws-msdevapps


Ken Sheridan
Stafford, England
 
I think the trick was to make the control invisible if there was no image
attached. Even though I was setting the picture property, images with no
picture would display the picture of the previous image.
Thanks for your help
Alec
 

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

Back
Top