Error Handling Problem

  • Thread starter Thread starter sandpking
  • Start date Start date
S

sandpking

Why isn't this catching the error that the file is too big to display.
(2114 <database name> doesn't support the format of the file <file
name here> or is too large...) Thanks in advance.


On Error GoTo Err_CallDisplayImage

Me!txtImageNote = DisplayImage(Me!ImageFrame, Me!txtImageName)

Exit_CallDisplayImage:
Exit Sub

Err_CallDisplayImage:

Me!txtImageNote = DisplayImage(Me!ImageFrame, Me!TooBigText)
 
Hi,

Not sure what you have there. If 2114 is the error number, something like
this would be a 'basic' error handler with that error number 'trapped' for
special treatment:

___________________________
Private Sub CallDisplayImage()

On Error GoTo Err_CallDisplayImage

Me!txtImageNote = DisplayImage(Me!ImageFrame, Me!txtImageName)

Exit_CallDisplayImage:
Exit Sub

Err_CallDisplayImage:
If Err.Number = 2114 Then
MsgBox "File too large"
Exit Sub
Else
MsgBox Err.Number & Err.Description
End If
End Sub
_____________________

HOpe that helps,
CW
 
On Error GoTo Err_CallDisplayImage ****This line is never triggered on the file too big error. It always goes to the line below. ***
 
On said:
- Show quoted text -

The error is never triggered. So far, I'm going to leave the error
alone as the jpg that caused the error was not a jpg after all. It
was corrupt. However, I'd like to show a standard jpg file if the jpg
cannot be opened.
 
Back
Top