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