You need to load
something like the routine below
on the format event of the report detail you need something like
Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
Call FindOldPhotoRpt(Me, Nz(HostPhotoPath), HostID)
End Sub
Public Function FindOldPhotoRpt(Rpt As Report, PhotoPath As String, ID As
Long)
'HKEY_LOCAL_MACHINE\Software\Microsoft\ Shared Tools\Graphics
Filters\Import\JPEG\Options ShowProgressDialog No
Dim MyDb As Database
Dim ImageTypeSet As Recordset
Dim Msg As String, FilterName As String
If Nz(ID) = 0 Or Nz(PhotoPath) = "" Then
Rpt!Photo.Picture = ""
Exit Function
End If
If Dir(PhotoPath) = "" Then ' not found
Msg = "Photo: " & PhotoPath & vbCrLf
Msg = Msg & "is not found at the above location (or is misspelled)"
MsgBox Msg, vbInformation, "Missing Photo"
Rpt.Photo.Picture = ""
Exit Function
End If
Set MyDb = CurrentDb
Set ImageTypeSet = MyDb.OpenRecordset("ImageTypes")
With ImageTypeSet
Do Until .EOF
If Right(Dir(PhotoPath), Len(!ImageType)) = !ImageType Then
.Close
GoTo LegalPhoto
End If
.MoveNext
Loop
.Close
End With
Rpt.Photo.Picture = "" ' Not a photo
Set ImageTypeSet = Nothing
Set MyDb = Nothing
Exit Function
LegalPhoto:
Rpt!Photo.Picture = PhotoPath
Set ImageTypeSet = Nothing
Set MyDb = Nothing
End Function
This is the routine I use.
One or 2 notes:
Assuming that all your pictures are JPGs you can delete anything to do with
the ImageType bit of the VB. This was in as certain types of pictures can
not be handled.
If you look at the registry there is a bit that says
'HKEY_LOCAL_MACHINE\Software\Microsoft\ Shared Tools\Graphics
Filters\Import\JPEG\Options ShowProgressDialog No. If it says Yes then you
will see an annoying dialogue box showing up that says something about
loading JPG
An example of the HostPhotoPath would be your
"C:\ABCcompany\Prods\Item894654.jpg). "
The HostID was a check on my bit of software that I was printing a person's
detail rather than some dummy information. This bit and the corresponding ID
can be omitted
I suppose it would have been easier to say
Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
Call FindOldPhotoRpt(Me, Nz(HostPhotoPath))
End Sub
Public Function FindOldPhotoRpt(Rpt As Report, PhotoPath As String)
'HKEY_LOCAL_MACHINE\Software\Microsoft\ Shared Tools\Graphics
Filters\Import\JPEG\Options ShowProgressDialog No
Dim MyDb As Database
Dim Msg As String, FilterName As String
If Nz(PhotoPath) = "" Then
Rpt!Photo.Picture = ""
Exit Function
End If
If Dir(PhotoPath) = "" Then ' not found
Msg = "Photo: " & PhotoPath & vbCrLf
Msg = Msg & "is not found at the above location (or is misspelled)"
MsgBox Msg, vbInformation, "Missing Photo"
Rpt.Photo.Picture = ""
Exit Function
End If
Rpt!Photo.Picture = PhotoPath
End Function
HTH
Phil
"Parasyke" <kr************@yahoo.comwrote in message
news:11*********************@f16g2000cwb.googlegro ups.com...
>I have a report that I want to print for a product specification sheet
with a photo of the product. I have the photos stored in a separate
folder from my Access 2000 database. I have a form that when I choose a
product all the info for that product appears on the form
appropriately, including the image path (e.g.
C:\ABCcompany\Prods\Item894654.jpg). The form's data appears
appropriately on the report for that item. How can I place an image on
the report and link it to the displayed path?
Thanks in advance!!