Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Pictures in image control don't refresh

Status
Not open for further replies.

accesser2

Technical User
Jan 15, 2004
8
US
Hi there,

I've looked at numerous posts out there but have yet to find a solution to this. I have an image control on a main form that shows a linked jpeg thumbnail. Image controls are also on 2 subforms that also show linked thumbnails.

When the user initially selects a jpeg from the Windows API Common Dialog Control, the image needs to immediately appear. I have the following code on the main form:

On Error GoTo err_Form_Current

If Not Me!Thumbnail_PathandFile = "" Or Not IsNull(Me!Thumbnail_PathandFile) Then
Me!Picture.Picture = GetPathPart & Me!Thumbnail_PathandFile
Else
Me!Picture.Picture = ""
End If

When the user goes to the next or previous record and then back to the one they just linked the jpeg to, the jpeg appears just fine. The images on the subforms are the same way--only appear after the user goes to the next or previous record and then back.

Any advice/assistance would be greatly appreciated.

Thanks much,

Arnold
 
All I have on mine is

Private Sub Form_Current()
Me!ImgPicture.Picture = Me!Link
RefreshDatabaseWindow

End Sub
Link is the name of the text field

Hope this helps
Hymn
 
Hi Hymn,

Thanks for responding. I've tried your code and the image still does not immediately appear after the link to the jpeg is added to the txtbox and the field looses focus. The only thing that updates the image is to leave the entire record and then return. Any other ideas?

Thanks,

Arnold
 
Arnold
you could try requery but it sound as if you need to save the record and then refresh
DoCmd.RunCommand acCmdSaveRecord
DoCmd.RunCommand acCmdrefresh

Hope this helps
Hymn
 
Hymn,

Thanks for your continued replies. I tried your code; good suggestion by the way. However, it still didn't work. What I may have to use is essentially the code in your first reply:

Me!Picture.Picture = Me!Thumbnail_PathandFile

in a lost or got focus event of another control. I have gotten this to work. But, what if the user skips this coded control? This is the scenario I'm trying to avoid/solve. Comments from you and and others have said that the OnCurrent event is where to solve this, but it just doesn't seem to work for me.

Thanks once again; let me know if you have any other suggestions.

Arnold.
 
I have a form with three buttons on
1/ to find the jpeg
GetFileInformation (Find_File(glInitDir))

Me!Link = glPath & "\" & glFileName

2/ to display the new jpeg
Me!ImgPicture.Picture = Me!Link

3/ to close the form

and the on current of course
Me!ImgPicture.Picture = Me!Link
RefreshDatabaseWindow

you will need the button to display the jpeg after using the button to find the jpeg which could be what your after. Once the jpeg has been found once it will automatically appear with the on current but it needs the code for the first time you find the jpeg

Hope this helps
Hymn
 
ps
off line for a fortnight

hope you resolve your problems

Hope this helps
Hymn
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top