franklin1232
IS-IT--Management
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 <> "" Then
Me!image100x.picture = strPicture
End If
strPicture = Me!Pic200x
If strPicture <> "" Then
Me!image200x.picture = strPicture
End If
Case 3
strPicture = Me!Pic100x
If strPicture <> "" Then
Me!image100x.picture = strPicture
End If
strPicture = Me!Pic200x
If strPicture <> "" Then
Me!image200x.picture = strPicture
End If
Case 5
strPicture = Me!Pic100x
If strPicture <> "" Then
Me!image100x.picture = strPicture
End If
strPicture = Me!Pic200x
If strPicture <> "" 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.
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 <> "" Then
Me!image100x.picture = strPicture
End If
strPicture = Me!Pic200x
If strPicture <> "" Then
Me!image200x.picture = strPicture
End If
Case 3
strPicture = Me!Pic100x
If strPicture <> "" Then
Me!image100x.picture = strPicture
End If
strPicture = Me!Pic200x
If strPicture <> "" Then
Me!image200x.picture = strPicture
End If
Case 5
strPicture = Me!Pic100x
If strPicture <> "" Then
Me!image100x.picture = strPicture
End If
strPicture = Me!Pic200x
If strPicture <> "" 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.