S
SteveWalker
Hi,
I've got a form displaying data from tables, which also displays a linked
image in an image control. When I change record on the form, I use VBA to
reload the image to match the new record. Images are stored as jpeg files in
a folder, and are linked to using the info in the record to get a filename.
This works fine, except when records are moved through too quickly, when it
causes Access to crash (AppName: msaccess.exe, ModName: jpegim32.flt). It
seems like this is caused by trying to load an image while the previous image
is still loading (the loading dialog for the previous image is still visible
when it crashes). Below is the code used for loading the image; I was
wondering if anyone had met this before, or knew of a workaround for it (a
way to pause code until the image has loaded maybe?).
Also, while I'm on the subject, a way to not display that "Loading image..."
pop-up would be great - SetWarnings = false and Echo = False don't work.
Thanks,
Steve Walker
Code:
Private Sub Load_Image()
DoCmd.SetWarnings False
Dim fs As Variant
Set fs = CreateObject("Scripting.FileSystemObject")
'Load picture
If fs.FileExists(CurrentProject.Path & "\StudentImages\" &
CurrentAdmissionNumber & ".jpg") Then
Image.Picture = CurrentProject.Path & "\StudentImages\" &
CurrentAdmissionNumber & ".jpg"
Image.Visible = True
Else
Image.Visible = False
End If
DoCmd.SetWarnings True
End Sub
I've got a form displaying data from tables, which also displays a linked
image in an image control. When I change record on the form, I use VBA to
reload the image to match the new record. Images are stored as jpeg files in
a folder, and are linked to using the info in the record to get a filename.
This works fine, except when records are moved through too quickly, when it
causes Access to crash (AppName: msaccess.exe, ModName: jpegim32.flt). It
seems like this is caused by trying to load an image while the previous image
is still loading (the loading dialog for the previous image is still visible
when it crashes). Below is the code used for loading the image; I was
wondering if anyone had met this before, or knew of a workaround for it (a
way to pause code until the image has loaded maybe?).
Also, while I'm on the subject, a way to not display that "Loading image..."
pop-up would be great - SetWarnings = false and Echo = False don't work.
Thanks,
Steve Walker
Code:
Private Sub Load_Image()
DoCmd.SetWarnings False
Dim fs As Variant
Set fs = CreateObject("Scripting.FileSystemObject")
'Load picture
If fs.FileExists(CurrentProject.Path & "\StudentImages\" &
CurrentAdmissionNumber & ".jpg") Then
Image.Picture = CurrentProject.Path & "\StudentImages\" &
CurrentAdmissionNumber & ".jpg"
Image.Visible = True
Else
Image.Visible = False
End If
DoCmd.SetWarnings True
End Sub