Re: How do I get pictures in a report to change with each record?



Sorry Connie,

I copied the code from an application of mine, where I've got the pathname
defined separately, so I'm only storing the filename in the table. If your
PictureFilename includes the path (ie. it's something like
c:\images\mypic.jpg), then simply omit the pathname - the relevant line will
be:
Me.imgPicture.Picture = Me.PictureFilename

HTH,

Rob

"Connie" <Connie@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:CFD91C74-3F5F-458A-9DF7-CD03DD1299E5@xxxxxxxxxxxxxxxx
> Thanks guys... I am still unable to display the pictures because of a
> compile error: Variable not defined... with the word "pathname"
highlighted
> in blue.
>
> Any ideas?
> Connie :)
>
> "Stephen Lebans" wrote:
>
> > Hi Rob,
> > if the OP does not need to change the dimensions of the Image control
> > then your code is better placed in the Print event of the relevant
> > section. Tlis will result in less chance of memory/resource issues at
> > Preview/Print time.
> >
> > --
> >
> > HTH
> > Stephen Lebans
> > http://www.lebans.com
> > Access Code, Tips and Tricks
> > Please respond only to the newsgroups so everyone can benefit.
> >
> >
> > "Rob Parker" <CUT_THIS robpparker at optusnet dot com dot au> wrote in
> > message news:e#spW$vQFHA.3628@xxxxxxxxxxxxxxxxxxxxxxx
> > > You need code such as this in the On Format event of the report
> > > section in which the image is to be displayed:
> > >
> > > Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
> > > If Me.PictureFilename <> vbNullString Then
> > > Me.imgPicture.Picture = pathname & Me.PictureFilename
> > > Me.imgPicture.Visible = True
> > > Else
> > > Me.imgPicture.Visible = False
> > > End If
> > > End Sub
> > >
> > > The above assumes that the image is to appear in the detail section,
> > that
> > > the field containing the filename is called PictureFilename, and that
> > the
> > > ImageControl is called imgPicture. Change to suit.
> > >
> > > HTH,
> > >
> > > Rob
> > >
> > >
> > > "Connie" <Connie@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
> > > news:49AAC734-C16D-4810-AA0A-A97CFC848C8E@xxxxxxxxxxxxxxxx
> > > > I have created a form for a realtor that displays a photo which
> > changes
> > > with
> > > > each record through an image path in the table. When I created the
> > > report,
> > > > however, the photo that appears is the same from record to record.
> > What
> > > am I
> > > > missing in the code? There are no error messages.
> > >
> > >
> >
> >


.



Relevant Pages