Image on report

P

Paul E. Schoen

I have a field called Image which is a filename for a JPG image that
displays properly on a form. When I try to use that field for the Picture
property in an Image control of a report, I get an error that Access cannot
find the field "Image". Yet it is in the query and appears in the list when
I enter "Me." I am using the OnPaint event for the GroupHeader where the
Image control is located.

The code is:

Private Sub GroupHeader1_Paint()
If Not IsNull(Me.Image) Then
imgHorse.Picture = Me.Image
End If
End Sub

If I substitute Me.HorseName I don't get that error, and I get the expected
error "Cannot open file 'Trigger'".

The query is as follows:

SELECT HORSE.EditDate, HORSE.HorseName, HORSE.Breed, HORSE.DOB, HORSE.Sex,
HORSE.Height, HORSE.Weight, HORSE.Color, Records.Type, Records.RecordDate,
Records.Provider, Records.Details, HORSE.ID, HORSE.Image FROM HORSE LEFT
JOIN Records ON HORSE.ID=Records.ID;

I tried changing the name of the record to ImageFile and Access2007
crashed. It's calling Uncle Bill right now to let him know.

The error reporting never completed so I clicked cancel, which started up
Access backup.

I successfully renamed the field, but it still gives the same error. I
changed the query to include all fields in both tables, but still no joy.

Also, I tried using the ImageFile field for imgHorse Control Source, but
that did not work. How is that used, anyway?

I added an invisible text box tbImageFile bound to ImageFile. When I used
that, it seemed to work (it displays the proper pictures), but goes into a
recursive loop:

Private Sub GroupHeader1_Paint()
sPath = CurrentProject.Path + "\"
If Not IsNull(Me.tbImageFile) Then
Rem imgHorse.Picture = sPath + Me.tbImageFile
End If
End Sub

There is probably some simple way to do this, but I can't figure it out.
Access is very powerful, but I find it very frustrating...

Thanks,

Paul
 
P

Paul E. Schoen

OK, it was a very simple thing after all. I stored the filenames of the
images with full path information, and used that as the control source.
Amazing what a little sleep can do!

Paul
 

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