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

How to refresh an image control

P: n/a
Hey there,

I've browsed for some fixes to this but only found a couple of similar
posts, which didn't solve my problem. I'm wondering how to refresh an
image control in a form after a user clicks a cmd button to open the
Windows API Common Dialog and selects a new file (jpeg). Images are
initially loaded in the form's oncurrent event. I've tried using
me.dirty = false to make the form current. Has anyone experienced
this before?

Thanks much.
Nov 12 '05 #1
Share this Question
Share on Google+
6 Replies


P: n/a
Just changing the image path will refresh the image that is displayed.
Use this in your proceedure somewhere after the user chooses the new file
path.

Me!ImageControl.Picture = "Path to new file"

Mike Storr
www.veraccess.com
"Arnold" <ee*******@earthlink.net> wrote in message
news:18**************************@posting.google.c om...
Hey there,

I've browsed for some fixes to this but only found a couple of similar
posts, which didn't solve my problem. I'm wondering how to refresh an
image control in a form after a user clicks a cmd button to open the
Windows API Common Dialog and selects a new file (jpeg). Images are
initially loaded in the form's oncurrent event. I've tried using
me.dirty = false to make the form current. Has anyone experienced
this before?

Thanks much.

Nov 12 '05 #2

P: n/a
Thanks Mike,

I was really wanting the image control to refresh immediately. For
instance, users will select thumbnails using the Windows API File
Browser. Once they do, I'd like for the image control to refresh
automatically, before users tab to another control or whatnot. Is
this doable?

Thanks,

Arnold

"Mike Storr" <st******@sympatico.ca> wrote in message news:<17*******************@news20.bellglobal.com> ...
Just changing the image path will refresh the image that is displayed.
Use this in your proceedure somewhere after the user chooses the new file
path.

Me!ImageControl.Picture = "Path to new file"

Mike Storr
www.veraccess.com
"Arnold" <ee*******@earthlink.net> wrote in message
news:18**************************@posting.google.c om...
Hey there,

I've browsed for some fixes to this but only found a couple of similar
posts, which didn't solve my problem. I'm wondering how to refresh an
image control in a form after a user clicks a cmd button to open the
Windows API Common Dialog and selects a new file (jpeg). Images are
initially loaded in the form's oncurrent event. I've tried using
me.dirty = false to make the form current. Has anyone experienced
this before?

Thanks much.

Nov 12 '05 #3

P: n/a
It does for me. The API call is returning a string containing the path to
the image. One of you events or functions are starting this process, that
same code can use the line I provided to reset the image before it ends. All
will appear to be done immediately. Or maybe I'm not quite understanding
you.
"Arnold" <ee*******@earthlink.net> wrote in message
news:18*************************@posting.google.co m...
Thanks Mike,

I was really wanting the image control to refresh immediately. For
instance, users will select thumbnails using the Windows API File
Browser. Once they do, I'd like for the image control to refresh
automatically, before users tab to another control or whatnot. Is
this doable?

Thanks,

Arnold

"Mike Storr" <st******@sympatico.ca> wrote in message

news:<17*******************@news20.bellglobal.com> ...
Just changing the image path will refresh the image that is displayed.
Use this in your proceedure somewhere after the user chooses the new file path.

Me!ImageControl.Picture = "Path to new file"

Mike Storr
www.veraccess.com
"Arnold" <ee*******@earthlink.net> wrote in message
news:18**************************@posting.google.c om...
Hey there,

I've browsed for some fixes to this but only found a couple of similar
posts, which didn't solve my problem. I'm wondering how to refresh an
image control in a form after a user clicks a cmd button to open the
Windows API Common Dialog and selects a new file (jpeg). Images are
initially loaded in the form's oncurrent event. I've tried using
me.dirty = false to make the form current. Has anyone experienced
this before?

Thanks much.

Nov 12 '05 #4

P: n/a
NB
For some unknown reason, I face the same problem (Access XP on Win
2000 Pro)

After attching the image path, the image control does not display that
picture immediately. However it does when you go to another record
then go back.

Here is the code I use under the command button. Anyone has an idea
why does it not refresh the image?

On Error GoTo ErrHandler
Dim lngFlags As Long
Dim strFilter As String
Dim strPathAndFile As String
Me.AllowDeletions = False
strFilter = ahtAddFilterItem(strFilter, "Compressed Image Files
(*.jpg, *.jff, *.gif, *.tiff )", _
"*.JPG;*.JFF,*.GIF,*.TIF")
strFilter = ahtAddFilterItem(strFilter, "Uncompressed Image Files
(*.bmp, *.wmf)", "*.BMP, *.WMF")
strFilter = ahtAddFilterItem(strFilter, "All Files (*.*)", "*.*")
strPathAndFile = ahtCommonFileOpenSave(InitialDir:="C:\", _
Filter:=strFilter, FilterIndex:=3, Flags:=lngFlags, _
DialogTitle:="Choose an Image File")
If Len(strPathAndFile) > 0 Then
Me![imagePath] = strPathAndFile
Me![productImage].Picture = strPathAndFile
Me!imagePathLink = strPathAndFile & "#" & strPathAndFile &
"##" & "Link to image"
Me.Refresh
Else
Cancel = True
End If
Exit_Sub:
Exit Sub
ErrHandler:
MsgBox "Error " & Err.Number & " : " & Err.Description,
vbExclamation
Resume Exit_Sub

NB
Nov 12 '05 #5

P: n/a
Thanks again for responding Mike;

I'm new to coding with Modules and interfacing with API/ActiveX
controls, and can't really decipher the module code, which creates
various variables, like glpath, strPathAndFileName, etc. I found the
API Common Dialog Browser control code on one of the Access sites and
created a module with it. In the form's oncurrent event, I have the
following code:

On Error GoTo err_Form_Current

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

I guess I don't know how to best modify the API code, and where best
to put the following code:

Me!ImageControl.Picture = Me!Thumbnail_Path

Thanks again,

Arnold

"Mike Storr" <no****@somewhere.con> wrote in message news:<E_********************@news20.bellglobal.com >...
It does for me. The API call is returning a string containing the path to
the image. One of you events or functions are starting this process, that
same code can use the line I provided to reset the image before it ends. All
will appear to be done immediately. Or maybe I'm not quite understanding
you.
"Arnold" <ee*******@earthlink.net> wrote in message
news:18*************************@posting.google.co m...
Thanks Mike,

I was really wanting the image control to refresh immediately. For
instance, users will select thumbnails using the Windows API File
Browser. Once they do, I'd like for the image control to refresh
automatically, before users tab to another control or whatnot. Is
this doable?

Thanks,

Arnold

"Mike Storr" <st******@sympatico.ca> wrote in message

news:<17*******************@news20.bellglobal.com> ...
Just changing the image path will refresh the image that is displayed.
Use this in your proceedure somewhere after the user chooses the new file path.

Me!ImageControl.Picture = "Path to new file"

Mike Storr
www.veraccess.com
"Arnold" <ee*******@earthlink.net> wrote in message
news:18**************************@posting.google.c om...
> Hey there,
>
> I've browsed for some fixes to this but only found a couple of similar
> posts, which didn't solve my problem. I'm wondering how to refresh an
> image control in a form after a user clicks a cmd button to open the
> Windows API Common Dialog and selects a new file (jpeg). Images are
> initially loaded in the form's oncurrent event. I've tried using
> me.dirty = false to make the form current. Has anyone experienced
> this before?
>
> Thanks much.

Nov 12 '05 #6

P: n/a
On 27 Jan 2004 17:25:12 -0800, Arnold wrote:

Thanks again for responding Mike;

I'm new to coding with Modules and interfacing with API/ActiveX
controls, and can't really decipher the module code, which creates
various variables, like glpath, strPathAndFileName, etc. I found the
API Common Dialog Browser control code on one of the Access sites and
created a module with it. In the form's oncurrent event, I have the
following code:

On Error GoTo err_Form_Current

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

I guess I don't know how to best modify the API code, and where best
to put the following code:

Me!ImageControl.Picture = Me!Thumbnail_Path

Thanks again,

Arnold


The message from NB seems to indicate this a problem in XP (2002 or 2003
I'm not sure). Is this your case as well? I haven't encountered this yet,
so I can't say why it does this. Wanted to make sure you understood that in
my example "Me!ImageControl.Picture", you are to replace the "ImageControl"
with the name of the image control you are using and Me!Thumbnail_Path with
the string being returned from the API you have used (I assumed there was a
textbox on the form displaying it).

If this still does not refresh to picture immediately, then try using
Me.Repaint to force access to redraw the form on screen.
--
Mike Storr
veraccess.com
Nov 12 '05 #7

This discussion thread is closed

Replies have been disabled for this discussion.