problem with images

  • Thread starter Thread starter Nabeel
  • Start date Start date
N

Nabeel

Hi,
I have a small problem with Access, I am using a 4 image control on a form
to display jpg images, the names are stored in a column in the table. The
form works fine, but if I rapidly browse through the records, after approx
5-6 records the application just closes, without any warning. If I turn it
on again it works fine, but same problem if I browse rapidly.
 
Thanks for your help, the solution suggested works fine with of my forms,
but I have one more form, here the users need to rapidly browse thru
records, they hate waiting for the images to load till the relevant record
is reached. Is there some other workaround, I am using Access 2002, should I
upgrade to solve the problem(may be increase the RAM?).
 
Last time I struck this, I placed an unbound toggle button on the form, so
the user could show the photos if they wish, or hide them for a fast browse.

Without cutting it down, this was the code.

Private Sub tglShowPhoto_AfterUpdate()
On Error GoTo Err_Handler

With Me.tglShowPhoto
If .Value Then
Call LoadTheImage(Me.ClientPhoto)
.ControlTipText = "Hide photos"
Else
Me.imgClientPhoto.Visible = False
Me.txtNoImage.Visible = False
.ControlTipText = "Show photos"
End If
End With

Exit_Handler:
Exit Sub

Err_Handler:
Call LogError(Err.Number, Err.Description, conMod &
".tglShowPhoto_AfterUpdate")
Resume Exit_Handler
End Sub

Private Sub Form_Current()
Call LoadTheImage(Me.ClientPhoto)
End Sub

Private Function LoadTheImage(varFile As Variant) As Boolean
On Error GoTo Err_Handler
'Purpose: Show/hide the picture, loading from file.
'Return: True if image loaded.
Dim bShow As Boolean
Dim strFullPath As String

With Me.imgClientPhoto
If (Me.tglShowPhoto.Value) Then
If Not (IsNull(varFile) Or IsNull(Me.txtImageFolder)) Then
'Check the file is still here. Can't show if it is not.
strFullPath = Me.txtImageFolder & varFile
If FileExists(strFullPath) Then
bShow = True
If .Picture = strFullPath Then
'do nothing
Else
Me.NavigationButtons = False 'This prevents a GPF
if the user move to another record before image is loaded.
.Picture = strFullPath
Me.NavigationButtons = True
End If
End If
End If
If .Visible <> bShow Then
.Visible = bShow
End If
Me.txtNoImage.Visible = Not bShow
Else
bShow = False
If .Visible Then
.Visible = False
End If
Me.txtNoImage.Visible = False
End If
End With

Exit_Handler:
Exit Function

Err_Handler:
Call LogError(Err.Number, Err.Description, conMod & ".LoadTheImage")
Resume Exit_Handler
End Function


If you want the error handler, see:
http://members.iinet.net.au/~allenbrowne/ser-23a.html
 
Hi Stephen,
First I would like to thank you for taking time to reply, the solution u
mentioned doesn't seem to solve the problem, the dialog still comes up, and
the application crashes after 5-6 rapid browsing of records. I am using
Windows XP professional and Access XP, is there any other places in registry
these changes need to be made.
 
It depends how you are logged on to WinXP. I think if you have no other
accounts setup on your machine and log on as Administrator then you can
simply add the required Reg Key to:
HKEY_LOCAL_MACHINE\Software\Microsoft\ Shared Tools\Graphics
Filters\Import\JPEG\Options
Remember you have to add the Key for each Image type you will be
displaying in the Image control.

If you have multiple acounts then you have to add the Reg Key to each
seperate account or HKEY_CURRENT_USER. Something like that but I
honestly don't remember for sure off the top of my head.

--

HTH
Stephen Lebans
http://www.lebans.com
Access Code, Tips and Tricks
Please respond only to the newsgroups so everyone can benefit.
 
Thanx, now it works, the changes have to be made in HKEY_CURRENT_USER too,
now the mouse pointer changes to hourglass when the images r loading and no
matter how fast u browse, it doesn't crash

THANKS A LOT
 
Back
Top