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!

Images in a report.

Status
Not open for further replies.

franklin1232

IS-IT--Management
Aug 29, 2001
207
US
I have a report that uses a query that will generally return between 3 to 6 records. Each record has to string fields that point to jpeg images. The following would bring three images in. The final code will have to use the recordcount because the recordset size is not static.

Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
Dim strPicture
DetailCount = DetailCount + 1
Select Case DetailCount
Case 1
strPicture = Me!Pic100x
If strPicture <> &quot;&quot; Then
Me!image100x.picture = strPicture
End If
strPicture = Me!Pic200x
If strPicture <> &quot;&quot; Then
Me!image200x.picture = strPicture
End If
Case 3
strPicture = Me!Pic100x
If strPicture <> &quot;&quot; Then
Me!image100x.picture = strPicture
End If
strPicture = Me!Pic200x
If strPicture <> &quot;&quot; Then
Me!image200x.picture = strPicture
End If
Case 5
strPicture = Me!Pic100x
If strPicture <> &quot;&quot; Then
Me!image100x.picture = strPicture
End If
strPicture = Me!Pic200x
If strPicture <> &quot;&quot; Then
Me!image200x.picture = strPicture
End If
End Select
End Sub

The Me!Pic100x changes every other detail format. The code seems to work fine. Each time a case is met the picture is imported. Problem is that the picture object doesn't seem to create different instances for each page. When I print the report all page have the last picture imported. How can I keep the different pictures from the different records.
 
You have to set the picture object source on every detail as:
Code:
Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
    On Error Resume Next
    Me![img].Picture = Me![ImagePath]
End Sub

Hope this helps,
Rewdee
 
I am not sure what you mean. The code in my first post does run under the Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer) event. My code is pretty much the same as yours except that I used a case statment because with out it the images are always the first one that was imported.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top