Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Display pictures with picture paths that work 1

Status
Not open for further replies.

kultx

Programmer
May 24, 2002
1
US
I have a report that displays pictures from a picture path - but I need to adjust the code so that it skips records that don't have a valid picture path - how do i do this?
 
Make sure that you have the object PicturePath in the Detail Section. It can be invisible but it must be there. Put the following code into the OnFormat event procedure of the Detail Section of the report:
[/code]
Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
On Error GoTo Detail_Error
Dim vFileLength as long
vFileLength = FileLen(Me![PicturePath])
Detail_Exit:
Exit Sub
Detail_Error:
DoCmd.CancelEvent
GoTo Detail_Exit
End Sub
[/code]
This tests for the validity of the path by trying to return the size of the file. If it cannot find it then it will error out at which time the error trap will Cancel the event. If it find the file and returns a value then it will continue through the Exit_Sub and allow for Formatting of the Detail Section.

Hope this helps your situation.

Bob Scriver
 
Kultx, I have been trying to get the pictures to picture on the report without success. I get black image boxes. How did you get the report to read the path. Thanks in advance.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top