Importing Progess Bar problem (1 Viewer)

JimH

Registered User.
Local time
Today, 00:37
Joined
Aug 15, 2004
Messages
19
On a form I call for an image from a specificed folder outside access. Photo's vary in size from a few kb to over 1 mb. I use the Oncurrent event of the form to assign the photo to the image box. An access created progress bar automattically appears as I move from one record to the next. My problem is if I want to move in several records I have to wait until each picture is fully imported otherwise the Importing progress bar simply locks up and remains in the forground of what ever record it locked up on. The underlying form can still be manupulated to the desired record by using the On Error Resume Next statement.

Does anyone have any ideas on how to resolve this? Thanks!

Private Sub Form_Current()
On Error Resume Next
Dim chkFileName As String
Dim chkNoPic As String

chkFileName = Dir(FindPath() & "\" & DLookup("[defaultFolder]", "tblPreferences", "[unitID] = 1") & Me.file)
chkNoPic = Dir(FindPath() & "\" & DLookup("[defaultFolder]", "tblPreferences", "[unitID] = 1") & "nopic.jpg")

If IsNull(Me.file) Or Me.file = "" Then 'if there is no file
On Error GoTo Err_Form_Current 'on error
If chkNoPic <> "." Or chkNoPic <> ".." Then
Me.frmImage.Picture = DLookup("[defaultPath]", "tblPreferences", "[unitID] = 1") & "nopic.jpg"
Else
Me.frmImage.Picture = ""
End If
Else
If chkFileName <> "" Then
Me.frmImage.Picture = DLookup("[defaultPath]", "tblPreferences", "[unitID] = 1") & chkFileName
Else
If chkNoPic <> "" Then
Me.frmImage.Picture = DLookup("[defaultPath]", "tblPreferences", "[unitID] = 1") & chkNoPic
Else
Me.frmImage.Picture = ""
End If
End If

End If
 

john471

Registered User.
Local time
Today, 15:37
Joined
Sep 10, 2004
Messages
392
Suggestion

Remove the picture loading code from the Form's OnCurrent event.

Move it to a dedicated command button (e.g. near where the picture would go) such that users can load pictures on demand, and don't have to wait for it to load if they don't want it, or are trying to scroll through multiple records - such as in your problem.

You may also then need to re-set the picture (to nothing) in the OnCurrent envent, so that the last picture "demanded" is not displayed in conjunction with a totally different record.
 

Users who are viewing this thread

Top Bottom