Results 1 to 5 of 5
  1. #1
    Gold Lounger
    Join Date
    Jan 2004
    Location
    Italy
    Posts
    3,245
    Thanks
    0
    Thanked 0 Times in 0 Posts

    server down or dtabase not existis (2000)

    Admit i have the tipical jet.oledb connection that point on a server Farm similar:

    ..........
    Dim CN As ADODB.Connection, RS As ADODB.Recordset
    Set CN = New ADODB.Connection
    Set RS = New ADODB.Recordset
    CN.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=GCD01F4500DATIPUBBLICAAPPLICAZIONIAREA.MDB; "
    ......

    how to trap this 2 error:

    1) mdb not found
    2) server is down
    ...

    in this case if one of this error is present during the code, appear msgbox based error found...

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: server down or dtabase not existis (2000)

    I'd create an error handler, at first like this:

    Sub Test()
    ...
    On Error GoTo ErrHandler
    ...
    CN.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=GCD01F4500DATIPUBBLICAAPPLICAZIONIAREA.MDB; "
    ...

    ExitHandler:
    On Error Resume Next
    RS.Close
    Set RS = Nothing
    CN.Close
    Set CN = Nothing
    Exit Sub

    ErrHandler:
    MsgBox "Error " & Err & " with description " & Err.Description, vbExclamation
    Resume ExitHandler
    End Sub

    When an error occurs, write down the error number and its meaning. When you know the relevant error numbers, change the error handling part:

    ErrHandler:
    Select Case Err
    Case -2147467259
    MsgBox "Path or filename not valid.", vbExclamation
    Case ...
    MsgBox "...", vbExclamation
    Case Else
    MsgBox "Error " & Err & " with description " & Err.Description, vbExclamation
    End Select
    Resume ExitHandler
    End Sub

    You can add Case ... statements for each error number that you want to intercept.

  3. #3
    Gold Lounger
    Join Date
    Jan 2004
    Location
    Italy
    Posts
    3,245
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: server down or dtabase not existis (2000)

    wow!!!!!!!!!!
    Tks for code and patience.

  4. #4
    Gold Lounger
    Join Date
    Jan 2004
    Location
    Italy
    Posts
    3,245
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: server down or dtabase not existis (2000)

    Hans sorry me but have a big difficult to integrate your "trap error" suggestion...
    Attached my code.
    Tks for all as usual.
    Sal.

  5. #5
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: server down or dtabase not existis (2000)

    You can create the error handler in Sub PATH_PROGETTO. You won't need the lines about the recordset RS because Sub PATH_PROGETTO doesn't use the recordset.

Posting Permissions

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