problem with images

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.
 
N

Nabeel

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?).
 
A

Allen Browne

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
 
N

Nabeel

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.
 
N

Nabeel

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
 
Top