strange problem when trying to display images in report!

A

Anja

Hi everyone,

I have a very strange problem happening when I try to show images on
my report.

So, my control source contains paths to images on the disk. This can
be NULL, in which case the picture control should not show an image.
The control source field is 'Photo' and the image control is called
Image32.

So, I have the following event handler:

Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
If Not IsNull(Me.Photo) Then

If Len(Dir(Me.Photo)) > 0 Then
Me.Image32.Picture = Me.Photo
Else
Me.Image32.Picture = ""
End If
Else
Me.Image32.Picture = ""
End If
End Sub

The problem is that as soon as one of the current record has a valid
image, all the subsequent records in my report contain that image!

So, I have 6 records...the first 2 contain NULL records and they show
up ok. Then I have a valid image, followed my 2 invalid images and
another null value... However, the valid image shows up on all 4
lines!!

Can someone tell me what I am doing wrong here. I would really
appreciate it!

Thanks,
Anja
 
P

Pendragon

set your source for the image to (none) - you can get this by simpy deleting
the source reference that currently exists.

in your OnFormat code, try this:

If isnull(Dir(Me.Photo)) Then
Else
If Len(Dir(Me.Photo)) > 0 Then
Me.Image32.Picture = Me.Photo
End If
End If
 

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