View Full Version : Updating image after changing records


daveUK
02-16-2002, 05:27 AM
I,ve created a database to store digital photos. The form that shows all the records (frmPhoto) has the Photo ID (Primary key, Autonumber) the name of the photo, a description and the location of the photo (i.e. D:\Photo\family1.jpg)
On the Form_load properties I have the following code:

Private Sub Form_Load()
Me!Image2.Picture = Me!Location

End Sub

This works fine with the first record image, but when the next and every other record is displayed, the image doesn't change.

I've tried using the same code
Me!Image2.Picture = Me!Location
on the onchange property of the form and the location text box but nothing happens.

Any ideas?

daveUK
02-17-2002, 05:20 AM
I've managed to do myself. In case anyone's interested the code is below.

Private Sub Form_Current()
On Error GoTo err_Form_Current

If Not Me!Location = "" Or Not IsNull(Me!Location) Then
Me!Image2.Picture = Me!Location
Else
Me!Image2.Picture = ""
End If

exit_Form_Current:
Exit Sub

err_Form_Current:
MsgBox Err.Description
Resume exit_Form_Current
End Sub