Results 1 to 3 of 3
  1. #1
    5 Star Lounger AndrewKKWalker's Avatar
    Join Date
    Apr 2001
    Location
    Cambridge, UK
    Posts
    1,020
    Thanks
    0
    Thanked 3 Times in 3 Posts

    Error NOT Trapped (2003)

    I have an Access Front end linking to a SQL Server 2005 back end for the tables.
    If the server name changes or password change then we need to trap the error at Startup
    by checking that we can link.

    As part of a startup routine I use the following Code (which works just fine if linking to another Access database).

    Dim varX

    'Some other stuff here

    'Check for table linked correctly
    On Error Resume Next
    varX = DCount("*", "tblDefaultValues")
    If Err.Number <> 0 Then
    'Here we decide what to do if it fails
    .................................................. .
    Else
    'Here is the stuff if it connects ok
    ...............................................
    End If

    This ought to work, BUT it does not.

    The error is returned as Run Time Error 3146 a network Error

    BUT it is ignored by the error handler instruction
    It comes up as an ODBC error and drops into the Code Window with Debug regardless.

    The Error Trapping is set to Break on Unhandled Errors because there are a lot of Error traps set
    and I do NOT want it to break on all errors.

    This would appear to be a handled error that is not handled.

    I have also tried to check the connection object with a connection string
    and to connect to an adodb and dao recordset instead of using DCount

    BUT all give the same problem, straight into debug ignoring the error handler.

    Any suggestions?
    Andrew

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

    Re: Error NOT Trapped (2003)

    See if you can trap the error using the On Error event of a form. More info in this MSKB article.

  3. #3
    5 Star Lounger AndrewKKWalker's Avatar
    Join Date
    Apr 2001
    Location
    Cambridge, UK
    Posts
    1,020
    Thanks
    0
    Thanked 3 Times in 3 Posts

    Re: Error NOT Trapped (2003)

    Thanks Hans.

    That article helped and I have now resolved the problem.

    BUT, we shouldn't have to do it that way.
    They ought to trap the error anyway.
    Andrew

Posting Permissions

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