Display photo/picture

S

SF

Hi,



I have a main form with the following controls:

1.. a combobox for selecting Commune Name/Code and
2.. a subform that display a list of Name, position and photo_path when
commune in the combobox is selected. I have put
3.. an image control/place holder that take the source photo path from
subform


I have completes step 1 and 2 but I cannot make the image control to work
cause I need to tell image control to go and look for photo source path in
the subform.



Could someone shading some light here?



SF
 
D

Damon Heron

From your description, it sounds like the subform has more than one record
when the combobox is selected. Then you want to display an image on the
main form when the individual record is clicked, correct?

Put an image control on main form.
Open the subform in design view and select the Click property.
enter this code, substituting your names for the imagecontrol and field that
holds the path to the picture.

Private Sub Form_Click()
Me.Parent!Image1.Picture = Me.Field1
End Sub

Damon
 
S

SF

Thank you very much for your tip. It works very well. I still have small
problem to reset the image control when there is no record in subform (the
image control still retain last photo).

SF
 
D

Damon Heron

Well, if you are sure the field that has the source path is blank, then use:

If Not IsNull(Me.Field1) Then
Me.Parent!Image1.Picture = Me.Field1
Else
Me.Parent!Image1.Picture = ""
End If

Otherwise, you will have to have some error handling routines to catch
problems with the address paths.

Damon
 
J

Jan Baird

Jan Baird is out of the country until September 20. Every effort will be
made to respond to messages, but please be patient.
 
J

Jan Baird

Jan Baird is out of the country until September 20. Every effort will be
made to respond to messages, but please be patient.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top