View Full Version : Multiple pictures in a form or report


s4rest
09-08-2010, 02:17 PM
Hi, I'm new to this forum and I hope I don't "prove there is such a thing as a stupid question" for my first post!

We had an outside firm do customer surveys taking three pictures of each outlet. I've received the data and want to build a form (1 page per outlet) showing the numerical results of the survey along with each of the three pictures taken of the outlet. The three pictures per record are portrayed as links (c:/pictures/outlet1.jpg).

I've been reviewing forums today and have figured out how to portray one picture (thanks to a great post by Anthony George on this forum..). However, I can't figure out how to post the three pictures. What I'd love to do is have the three pictures on top of the form with the data below.

I would appreciate any advice or direction! Thanks


Steve

Simon_MT
09-08-2010, 02:52 PM
I would suggest that each retail outlet must have unique images so we should be able to establish what image belongs to each outlet

ImageFile1 = OutletID_1.jpg
ImageFile2 = OutletID_2.jpg
ImageFile3 = OutletID_3.jpg

Put these on iether in your Query or Form or Both

Three Unbound Image Control on your Form

ImageControl1
ImageControl2
ImageControl3

On the form's On Current Function:



Function GetPicture()

Dim FullPath1 As String
Dim FullPath2 As String
Dim FullPath3 As String

With CodeContextObject
FullPath1 = GetImageDir & .[ImageFile1]
FullPath2 = GetImageDir & .[ImageFile2]
FullPath3 = GetImageDir & .[ImageFile3]

If Dir([FullPath1]) <> Empty Then
.[ImageControl1].Visible = True
.[ImageControl1].Picture = FullPath1
Else
.[ImageControl1].Visible = False
End If

If Dir([FullPath2]) <> Empty Then
.[ImageControl2].Visible = True
.[ImageControl2].Picture = FullPath2
Else
.[ImageControl2].Visible = False
End If

If Dir([FullPath3]) <> Empty Then
.[ImageControl3].Visible = True
.[ImageControl3].Picture = FullPath3
Else
.[ImageControl3].Visible = False
End If
End With

End Function


You will need this as well



Function GetImageDir() As String

GetImageDir = "C:\Pictures\"

End Function


Simon

boblarson
09-08-2010, 02:53 PM
Or just use a subform.

s4rest
09-09-2010, 06:54 AM
Simon and Bob,

Thanks for your replies!

This was very helpful.


Steve