Linked image not displayed on form

S

shelter

I am running Access 2003.

Thanks to one of John Viescas' books, I've been able to add and
display an image on a form. Unfortunately, as soon as I move to a new
record in the form, then go back to the first record, the first
record's image is no longer displayed.

Thank you for any help.

DJohnson

Here is my code to display the image:

Private Sub Form_Current()
Dim strPath As String

If Me.NewRecord Then
Me.lblMsg.Caption = "Click Add to insert a photo of this
volunteer."
Me.lblMsg.Visible = True
Me.imgVolunteer.Visible = False
Exit Sub
End If

On Error Resume Next
If IsNull(Me.Photo) Then
Me.lblMsg.Caption = "Click Add to insert a photo of this
volunteer."
Me.lblMsg.Visible = True
Me.imgVolunteer.Visible = False
Else
strPath = Me.txtPhoto
If (InStr(strPath, ":") = 0) And (InStr(strPath, "\\") = 0)
Then
strPath = CurrentProject.Path & "\" & strPath
End If
Me.imgVolunteer.Picture = strPath
If Err <> 0 Then
Me.lblMsg.Caption = "Photo not found. Click Add to
correct."
Me.lblMsg.Visible = True
Me.imgVolunteer.Visible = False
Else
Me.imgVolunteer.Visible = True
Me.PaintPalette = Me.imgVolunteer.ObjectPalette
End If
End If
End Sub
 
C

Carl Rapson

I am running Access 2003.

Thanks to one of John Viescas' books, I've been able to add and
display an image on a form. Unfortunately, as soon as I move to a new
record in the form, then go back to the first record, the first
record's image is no longer displayed.

Thank you for any help.

DJohnson

Here is my code to display the image:

Private Sub Form_Current()
Dim strPath As String

If Me.NewRecord Then
Me.lblMsg.Caption = "Click Add to insert a photo of this
volunteer."
Me.lblMsg.Visible = True
Me.imgVolunteer.Visible = False
Exit Sub
End If

On Error Resume Next
If IsNull(Me.Photo) Then
Me.lblMsg.Caption = "Click Add to insert a photo of this
volunteer."
Me.lblMsg.Visible = True
Me.imgVolunteer.Visible = False
Else
strPath = Me.txtPhoto
If (InStr(strPath, ":") = 0) And (InStr(strPath, "\\") = 0)
Then
strPath = CurrentProject.Path & "\" & strPath
End If
Me.imgVolunteer.Picture = strPath
If Err <> 0 Then
Me.lblMsg.Caption = "Photo not found. Click Add to
correct."
Me.lblMsg.Visible = True
Me.imgVolunteer.Visible = False
Else
Me.imgVolunteer.Visible = True
Me.PaintPalette = Me.imgVolunteer.ObjectPalette
End If
End If
End Sub

Try putting a breakpoint on the first executable statement in Form_Current
and step through the code to see just what's happening and where any error
might be occurring.

Carl Rapson
 
S

shelter

Try putting a breakpoint on the first executable statement in Form_Current
and step through the code to see just what's happening and where any error
might be occurring.

Carl Rapson- Hide quoted text -

- Show quoted text -

Thank you for your response.
 

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