Results 1 to 3 of 3
  1. #1
    Join Date
    Nov 2004
    Posts
    1

    Unanswered: Second error will not go to error handling

    I am fairly new to this and for the life of me can not figure out why this is not working. The code goes out to a specific workstation on the network and checks on a file. I have it so if the workstation and or file is not there (error 53) I will then display the missing workstation. Ok now that is done, the problem is when there are more then one error the first error works fine, but when it gets to the second error (the same one "53") it does not go to the errorhandler:. I just get a messagebox that states the error and the code stops. HELP! What stupid thing am I missing.

    ************************************************** ****
    On Error GoTo errorhandler

    Dim datetemp1, datetemp2, datetemp3, datetemp4 As Date

    datetemp4 = FileDateTime("\\server\drive\directory\file.mdb")
    Text3 = datetemp4
    Size2 = FileLen("\\server\drive\directory\file.mdb")
    Text4 = Size2

    workstation1:
    machine = "workstation"
    datetemp1 = FileDateTime("\\workstation1\dir1\file.mdb")
    Text1 = datetemp1
    Size1 = FileLen("\\workstation1\dir1\file.mdb")
    Text2 = Size1

    workstation2:
    On Error GoTo errorhandler
    machine = "workstation2"
    datetemp2 = FileDateTime("\\workstation2\dir1\file.mdb")
    Text5 = datetemp2
    Size2 = FileLen("\\workstation2\dir1\file.mdb")
    Text6 = Size2

    workstation3:
    On Error GoTo errorhandler
    machine = "workstation3"
    datetemp3 = FileDateTime("\\workstation3\dir1\file.mdb")
    Text7 = datetemp3
    Size3 = FileLen("\\workstation3\dir1\file.mdb")
    Text8 = Size3
    GoTo Finish

    errorhandler:
    Select Case Err.Number
    Case 53
    If machine = "workstation1" Then
    Text9 = ("Could Not Find" + " " + machine)
    Text9.Visible = True
    Err.Clear
    GoTo workstation2
    End If
    If machine = "workstation2" Then
    Text10 = ("Could Not Find" + " " + machine)
    Text10.Visible = True
    Err.Clear
    GoTo workstation3
    End If
    If machine = "workstation3" Then
    Text11 = ("Could Not Find" + " " + machine)
    Text11.Visible = True
    Err.Clear
    End If
    Case Else
    End Select

    ************************************************** *****
    I changed some of the code to protect the innocent.

    Thanks Again

  2. #2
    Join Date
    May 2004
    Posts
    97
    Your code is incomplete, or you did not include all of it. Any on error code should include a resume statement. Until your code hits a resume, it assumes the code it is executing is still in the error code routine.

    Maybe a revamp of your logic is needed?

  3. #3
    Join Date
    Nov 2004
    Posts
    108
    Code:
    workstation2:
    On Error GoTo errorhandler  'comment this line
    
    workstation3:
    On Error GoTo errorhandler  'comment this line

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •