Picture problem

G

Gina Whipp

I have a main form with a subform which has pictures on it. Not every
record has a picture. The code I use to load the picture on the subform is
as follows:

Private Sub Form_Current()
On Error Resume Next
If IsNull([txtImagePath]) Then
Me.imgImage.Picture = ""
Else
Me.imgImage.Picture = Me.txtImagePath
End If
End Sub

I also have this code on the Form_AfterUpdate event. However, if I go to a
record that has no image it keeps the same image as the record before and if
you close the menu and reopen and the first record has no picture it retains
the same image. I need for the image to be blank. Can someone tell me what
I am missing?

Control: Image
Picture: (none) EXCEPT if it loads a picture and there is no picture for the
next record it will retain prior image path.
Picture Type: Linked (tried Embedded)
Size Mode: Zoom

Oh, and yes the rest of the subform information updates just fine.

Thanks,
Gina Whipp

"I feel I have been denied critical, need to know, information!" - Tremors
II
 
G

Guest

Try:

Private Sub Form_Current()
On Error Resume Next
If IsNull([txtImagePath]) Then
Me.imgImage.Picture = ""
Me.imgImage.Visible = False
Else
Me.imgImage.Picture = Me.txtImagePath
Me.imgImage.Visible = True
End If
End Sub
 
G

Gina Whipp

Thanks Duane, that did it!

--
Gina Whipp

"I feel I have been denied critical, need to know, information!" - Tremors
II


Duane Hookom said:
Try:

Private Sub Form_Current()
On Error Resume Next
If IsNull([txtImagePath]) Then
Me.imgImage.Picture = ""
Me.imgImage.Visible = False
Else
Me.imgImage.Picture = Me.txtImagePath
Me.imgImage.Visible = True
End If
End Sub


--
Duane Hookom
Microsoft Access MVP


Gina Whipp said:
I have a main form with a subform which has pictures on it. Not every
record has a picture. The code I use to load the picture on the subform
is
as follows:

Private Sub Form_Current()
On Error Resume Next
If IsNull([txtImagePath]) Then
Me.imgImage.Picture = ""
Else
Me.imgImage.Picture = Me.txtImagePath
End If
End Sub

I also have this code on the Form_AfterUpdate event. However, if I go to
a
record that has no image it keeps the same image as the record before and
if
you close the menu and reopen and the first record has no picture it
retains
the same image. I need for the image to be blank. Can someone tell me
what
I am missing?

Control: Image
Picture: (none) EXCEPT if it loads a picture and there is no picture for
the
next record it will retain prior image path.
Picture Type: Linked (tried Embedded)
Size Mode: Zoom

Oh, and yes the rest of the subform information updates just fine.

Thanks,
Gina Whipp

"I feel I have been denied critical, need to know, information!" -
Tremors
II
 

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