• Error Trapping (97)

    Author
    Topic
    #361638

    I’m working on a problem for someone. They want to fill a field in a Table with the database version for each Db in the table. The Table contains a field called Databases which is the complete path to each database. I then wrote some code to fill the field dbVersion with the version number. Works great except if the Db is a newer version than 97(don’t ask me why about any of this because I don’t know). Now the first time I come across a version newer than 97 I am able to trap the Error ( 3343) and insert the text “Jet Error – New Version” in the field dbVersion. But the second time i come across Error 3343 it will not trap it. In my test data, it is two records in a row. I have added Err.Clear but that doesn’t do anything. Anyone have any thoughts. Thanks
    Paul

    Viewing 0 reply threads
    Author
    Replies
    • #547283

      Have you tried turning the error handler back on after handling the error?

      • #547301

        I’m not sure what you mean. My code is:
        Function FnVersion()
        On Error GoTo JetError
        Bla
        Bla
        Bal
        JetError:
        If Err.Number =3343 Then
        Bla-Bla
        Err.Clear
        End If
        rst.MoveNext
        Loop

        When it hits 3343 the first time it works but how would I turn it back on? Thanks for any help.
        Paul

        • #547356

          I got lost in your explanation of storing databases in tables. Are they trying to manage a bunch of databases by storing information about them in still another database?

          Anyhow, you didn’t build your error handling correctly, which is why you’re only firing it once. Try it this way instead:

          Function FnVersion()
          On Error GoTo JetError
          Bla
          Bla
          Do While Not rst.EOF
          Bal
          rst.MoveNext
          Loop

          Exit function

          JetError:
          If Err.Number =3343 Then
          Resume Next
          Else
          Bla-Bla
          Err.Clear
          End If
          End Function

          • #547403

            Thank you Charlotte. I will try it first thing this morning. Error handling isn’t one of my strengths. I really don’t know why they are storing the paths to databases(the question came up in another forum). I wrote the code to determine the version but they had Db’s that were newer than the Db they were storing the paths in so I added a branch to handle the Error. I just didn’t handle it properly it seems. I’ll let you know how it goes. Thanks again.
            Paul

          • #547460

            With just minor changes everything works great. Thanks for the help.
            Paul

    Viewing 0 reply threads
    Reply To: Error Trapping (97)

    You can use BBCodes to format your content.
    Your account can't use all available BBCodes, they will be stripped before saving.

    Your information: