I have a large number of photos linked to display in a report and a form.
This is set up so that the image frame will look for the appropriate file
without incorporating it as an OLE object:
'define the photo file name'
Dim thePhotoPath1 As String
thePhotoPath1 = theDbFolder & "GazetteerMaps\" & theSite & ".jpg"
Dim thePhotoPath2 As String
thePhotoPath2 = theDbFolder & "GazetteerPhotos\" & theSite & ".jpg"
'set each image frame to contain a photo
Me.ImgPhoto1.Picture = thePhotoPath1
Me.ImgPhoto2.Picture = thePhotoPath2
Presently, there needs to be a file for every site, or I get an error
message to debug. Is there some code that will tell the image frame
(ImgPhoto1 and 2) to display a default image or to simply not display in the
event of a photo not being present?
John Smith - 22 May 2008 17:53 GMT
Use the Dir command:
If Dir(thePhotoPath1) = "" Then
' Do whatever you wish when there is no file
Else
Me.ImgPhoto1.Picture = thePhotoPath1
End If
HTH
John
##################################
Don't Print - Save trees
> I have a large number of photos linked to display in a report and a form.
> This is set up so that the image frame will look for the appropriate file
[quoted text clipped - 14 lines]
> (ImgPhoto1 and 2) to display a default image or to simply not display in the
> event of a photo not being present?