D
Doug Sanders
I've got a small loop that looks for data in 1 of 4 places. If it doesn't
find a valid path it should create an error 53 which should then be
processed.
In most cases, the path to the desired file will be invalid and Error 53
will occur.
The code is this:
PictureNum = 0
Check1:
PictureNum = PictureNum + 1
If PictureNum = 5 Then Exit Sub
On Error GoTo Error53Check
If PictureNum = 1 Then FilePath = ("N:\Casefiles\" & [CASENO] & "\" &
[CASENO] & "-dp0.jpg")
If PictureNum = 2 Then FilePath = ("N:\Casefiles\" & [CASENO] & "\" &
[CASENO] & "-dp00.jpg")
If PictureNum = 3 Then FilePath = ("N:\Casefiles\" & [CASENO] &
"-dp0.jpg")
If PictureNum = 4 Then FilePath = ("N:\Casefiles\" & [CASENO] &
"-dp00.jpg")
Open FilePath For Input As #10
Close #10
Me![Image151].Picture = FilePath
GoTo Check1
Error53Check:
ErrNum = err
If err <> 53 Then GoTo MsgBoxNot53
If PictureNum = 4 Then Exit Sub
GoTo Check1
MsgBoxNot53:
Call Error_Handler(ErrNum) 'MsgBox "Some other error occured.
Error Number " & err
The first time through, it works fine when it has a bad path, it errors and
loops back. But when it loops back to 'Check1', increments PictureNum and
doesn't find the the path, instead going to Error53Check again, I get the
standard Access error box.
Hope this makes sense.
Thanks,
Doug Sanders
find a valid path it should create an error 53 which should then be
processed.
In most cases, the path to the desired file will be invalid and Error 53
will occur.
The code is this:
PictureNum = 0
Check1:
PictureNum = PictureNum + 1
If PictureNum = 5 Then Exit Sub
On Error GoTo Error53Check
If PictureNum = 1 Then FilePath = ("N:\Casefiles\" & [CASENO] & "\" &
[CASENO] & "-dp0.jpg")
If PictureNum = 2 Then FilePath = ("N:\Casefiles\" & [CASENO] & "\" &
[CASENO] & "-dp00.jpg")
If PictureNum = 3 Then FilePath = ("N:\Casefiles\" & [CASENO] &
"-dp0.jpg")
If PictureNum = 4 Then FilePath = ("N:\Casefiles\" & [CASENO] &
"-dp00.jpg")
Open FilePath For Input As #10
Close #10
Me![Image151].Picture = FilePath
GoTo Check1
Error53Check:
ErrNum = err
If err <> 53 Then GoTo MsgBoxNot53
If PictureNum = 4 Then Exit Sub
GoTo Check1
MsgBoxNot53:
Call Error_Handler(ErrNum) 'MsgBox "Some other error occured.
Error Number " & err
The first time through, it works fine when it has a bad path, it errors and
loops back. But when it loops back to 'Check1', increments PictureNum and
doesn't find the the path, instead going to Error53Check again, I get the
standard Access error box.
Hope this makes sense.
Thanks,
Doug Sanders