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

Pictures in image control don't refresh

P: n/a
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
Nov 12 '05 #1
Share this Question
Share on Google+
6 Replies


P: n/a

"Arnold" <ee*******@earthlink.net> wrote in message
news:18**************************@posting.google.c om...
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

Nov 12 '05 #2

P: n/a
Sure looks as if you have that code in the form's OnCurrent event procedure.
That procedure fires when you move between records, as you describe.

Put the whole thing into a Sub of its own.

Put a call to it in your OnCurrent event procedure.
Then put another call to it immediately after you retrieve the filename from
the API call.

HTH
- Turtle

"Arnold" <ee*******@earthlink.net> wrote in message
news:18**************************@posting.google.c om...
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

Nov 12 '05 #3

P: n/a
"Arnold" <ee*******@earthlink.net> wrote in message
news:18**************************@posting.google.c om...
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



This seems perfectly normal - you have code written in the form's OnCurrent
event and it works when you go to the next or previous record. What you
should be looking at is the event which occurs as the user is selecting an
image. This event might be from a command button's OnClick event.
I don't know the exact code you use to select the path, but I assume you can
write it as GetPath() which returns the full path if a file is selected and
"" if the user cancels. Then you would have something like:

Private Sub cmdGetImage_Click()

On Error GoTo Err_Handler

Dim strPath As String

strPath = GetPath()

If Len(strPath) > 0 Then
Me.imgMain.Picture = strPath
Me!Thumbnail_PathandFile = strPath
End If

Exit_Handler:
Exit Sub

Err_Handler:
MsgBox Err.Description, vbExclamation, "Error No: " & Err.Number
Resume Exit_Handler

End Sub


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. Any idea
why it does 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
Quite simple.
While your code collects the path/filename and stores it in your table,
there is nothing in your code to change the Picture property of your image
control.
When you change that property, the image will be updated.

HTH
- Turtle

"NB" <ni******@lycos.com> wrote in message
news:5c**************************@posting.google.c om...
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. Any idea
why it does 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 #6

P: n/a
Thanks Fletcher and MacDermott for answering both of the questions I
posted the other day. For the other post, I did figure out the error
with more aggressive debugging, which I had never really studied
before. If I'm going be trying to develop apps, then I guess I must
also debug--I'm sure I have plenty of bugs.

For the image refresh business, I'll try both of your suggestions when
I get a chance. I pulled the API browser control code off one of the
Access sites; I guess I need to study it more--not sure at the moment
where to add a call after the API file retrieve. The browser control
module is invoked from a cmdbutton on my form, next to the field in
which the image file name and path is inserted.

Thanks again,

Arnold
Nov 12 '05 #7

This discussion thread is closed

Replies have been disabled for this discussion.