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
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