By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,493 Members | 1,179 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,493 IT Pros & Developers. It's quick & easy.

Linked image will not refresh when image property is changed.

P: n/a
Scenario: Have a product form with an "image location" field. The
image property uses this field to display the image.

Problem: If an image location field has been changed, the image will
not refresh, even after putting a "refresh", or "repaint" or "requery"
statement in the afterupdate event. The only way to make it update is
to move to the next record and then move back again.
Private Sub Stock_ImageLocation_AfterUpdate()
If Me.Stock_ImageLocation.Value "1" Then
Me.Image98.Picture = Me.Stock_ImageLocation

Me.Refresh

If Len(Me.Stock_ImageLocation & "") 0 _
And Len(Dir(Me.Stock_ImageLocation)) 0 Then
Me.Image98.Picture = Me.Stock_ImageLocation
Me.Image98.Visible = True
Else
Me.Image98.Visible = False
End If
Else
Me.Image98.Visible = False
Me.Repaint
End If

End Sub

Hope you can help.

Feb 16 '07 #1
Share this Question
Share on Google+
5 Replies


P: n/a
On 16 Feb., 14:28, mattcolen...@gmail.com wrote:
Scenario: Have a product form with an "image location" field. The
image property uses this field to display the image.

Problem: If an image location field has been changed, the image will
not refresh, even after putting a "refresh", or "repaint" or "requery"
statement in the afterupdate event. The only way to make it update is
to move to the next record and then move back again.

Private Sub Stock_ImageLocation_AfterUpdate()
[]
Possibly the AfterUpdate event doesn't happen at all.
So far as I tested it under AfterUpdate(), it refreshes the picture
only after I quit someway the field (Tab, Enter, navigate, move
focus).

Put a MsgBox "hallo" in AfterUpdate() and see.

Or put your code under the Change event instead of AfterUpdate and see
what happens.

If it still doesn't refresh the picture, tell us.

Marco P
Feb 16 '07 #2

P: n/a
On 16 Feb, 14:18, "Marco Pagliero" <mart...@web.dewrote:
On 16 Feb., 14:28, mattcolen...@gmail.com wrote:
Scenario: Have a product form with an "image location" field. The
image property uses this field to display the image.
Problem: If an image location field has been changed, the image will
not refresh, even after putting a "refresh", or "repaint" or "requery"
statement in the afterupdate event. The only way to make it update is
to move to the next record and then move back again.
Private Sub Stock_ImageLocation_AfterUpdate()
[]

Possibly the AfterUpdate event doesn't happen at all.
So far as I tested it under AfterUpdate(), it refreshes the picture
only after I quit someway the field (Tab, Enter, navigate, move
focus).

Put a MsgBox "hallo" in AfterUpdate() and see.

Or put your code under the Change event instead of AfterUpdate and see
what happens.

If it still doesn't refresh the picture, tell us.

Marco P
Thanks for taking a look. after putting a msgbox in both _change and
_afterupdate, it does not pop the message up.

*************One thing I have forgotten to mention is that the
imagepath field is update using vba**************

If I type in a file path manually all appears to work without issue. I
am calling an explorer popup to select a file (and record the filename
and path in the filepath field). It would appear that none of my
"me.refresh" are working. Thanks for looking into this again.

Feb 16 '07 #3

P: n/a
On 16 Feb., 16:03, mattcolen...@gmail.com wrote:
Thanks for taking a look. after putting a msgbox in both _change and
_afterupdate, it does not pop the message up.

*************One thing I have forgotten to mention is that the
imagepath field is update using vba**************
Yes, also the help says that _change and _afterupdate aren't
triggered if the new value comes from VB or from a macro.

But if I change the .picture property from VB, the control seems to
refresh allright, so try and set the property directly in the module
after you get the filename and set Stock_ImageLocation.

I mean, somewhere you must have written something like:

forms!myForm!Stock_ImageLocation = somefilenamefromexplorer

then the next line will be

forms!yourForm!Image98.Picture = forms!yourForm!Stock_ImageLocation
(forms!yourForm!Image98.Picture = somefilenamefromexplorer)

There you can also set .visible if you like.

greetings
Marco P

Feb 16 '07 #4

P: n/a
On 16 Feb, 16:42, "Marco Pagliero" <mart...@web.dewrote:
On 16 Feb., 16:03, mattcolen...@gmail.com wrote:
Thanks for taking a look. after putting a msgbox in both _change and
_afterupdate, it does not pop the message up.
*************One thing I have forgotten to mention is that the
imagepath field is update using vba**************

Yes, also the help says that _change and _afterupdate aren't
triggered if the new value comes from VB or from a macro.

But if I change the .picture property from VB, the control seems to
refresh allright, so try and set the property directly in the module
after you get the filename and set Stock_ImageLocation.

I mean, somewhere you must have written something like:

forms!myForm!Stock_ImageLocation = somefilenamefromexplorer

then the next line will be

forms!yourForm!Image98.Picture = forms!yourForm!Stock_ImageLocation
(forms!yourForm!Image98.Picture = somefilenamefromexplorer)

There you can also set .visible if you like.

greetings
Marco P
Dude, how stupid am I. Guess what.........

I was concentrating so much on making the filepath field update that I
completely missed to update the actual .picture property. I'm not
gonna say how long I have been looking at the code, trying to make it
work! What I numpty. It was only when I saw your

(forms!yourForm!Image98.Picture = somefilenamefromexplorer)

statement that I knew what I was doing wrong. Your a genious.... We
are mere peasants.

Thanks for your help.
CASE CLOSED!!!


Feb 16 '07 #5

P: n/a
On 16 Feb., 20:31, mattcolen...@gmail.com wrote:
>
Dude, how stupid am I. Guess what.........

I was concentrating so much on making the filepath field update that I
completely missed to update the actual .picture property. I'm not
gonna say how long I have been looking at the code, trying to make it
work! What I numpty. It was only when I saw your

(forms!yourForm!Image98.Picture = somefilenamefromexplorer)

statement that I knew what I was doing wrong. Your a genious.... We
are mere peasants.

Thanks for your help.
Hi Matt, don't be sad, it happens again and again to focus so much on
some special solution that one doesn't see the original problem any
more. As some say: concentrate on the fur, but don't forget the claws.

Glad I could help, and to be called a genius once in a while is also
quite agreable but don't do it too often, please. You would embarrass
me, as I'm much too modest. This is actually my only fault.

Greetings
Marco P

Feb 18 '07 #6

This discussion thread is closed

Replies have been disabled for this discussion.