Results 1 to 4 of 4
  1. #1
    New Lounger
    Join Date
    Aug 2001
    Location
    Amarillo, Texas, USA
    Posts
    10
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Error Codes (Access 2K)

    Does anyone know a way to find out what the error message numbers represent?

  2. #2
    Silver Lounger
    Join Date
    Jan 2001
    Location
    Indianapolis, Indiana, USA
    Posts
    1,862
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Error Codes (Access 2K)

    According to the Access97 Help files (I don't think this one was included with 2000/2002), paste this into a Module and run the AccsessAndJetErrorsTable() function:<pre>Function AccessAndJetErrorsTable() As Boolean
    Dim dbs As Database, tdf As TableDef, fld As Field
    Dim rst As Recordset, lngCode As Long
    Dim strAccessErr As String
    Const conAppObjectError = "Application-defined or object-defined error"

    On Error GoTo Error_AccessAndJetErrorsTable
    ' Create Errors table with ErrorNumber and ErrorDescription fields.
    Set dbs = CurrentDb
    Set tdf = dbs.CreateTableDef("AccessAndJetErrors")
    Set fld = tdf.CreateField("ErrorCode", dbLong)

    tdf.Fields.Append fld
    Set fld = tdf.CreateField("ErrorString", dbMemo)
    tdf.Fields.Append fld

    dbs.TableDefs.Append tdf
    ' Open recordset on Errors table.
    Set rst = dbs.OpenRecordset("AccessAndJetErrors")
    ' Loop through error codes.
    For lngCode = 0 To 3500
    On Error Resume Next
    ' Raise each error.
    strAccessErr = AccessError(lngCode)
    DoCmd.Hourglass True
    ' Skip error numbers without associated strings.
    If strAccessErr <> "" Then

    ' Skip codes that generate application or object-defined errors.
    If strAccessErr <> conAppObjectError Then
    ' Add each error code and string to Errors table.
    rst.AddNew
    rst!ErrorCode = lngCode
    ' Append string to memo field.
    rst!ErrorString.AppendChunk strAccessErr
    rst.Update
    End If
    End If
    Next lngCode
    ' Close recordset.
    rst.Close
    DoCmd.Hourglass False
    RefreshDatabaseWindow
    MsgBox "Access and Jet errors table created."

    AccessAndJetErrorsTable = True

    Exit_AccessAndJetErrorsTable:
    Exit Function

    Error_AccessAndJetErrorsTable:
    MsgBox Err & ": " & Err.Description
    AccessAndJetErrorsTable = False
    Resume Exit_AccessAndJetErrorsTable
    End Function</pre>

    HTH <img src=/S/salute.gif border=0 alt=salute width=15 height=20>

  3. #3
    Plutonium Lounger
    Join Date
    Dec 2000
    Location
    Sacramento, California, USA
    Posts
    16,775
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Error Codes (Access 2K)

    Make sure you have the DAO 3.6 reference set first, though, and it would be a very good idea to replace these declarations
    <hr>Dim rst As Recordset
    Dim fld As Field<hr>
    with this
    <hr>Dim rst As DAO.Recordset
    Dim fld As DAO.Field<hr>
    Otherwise, your code will not compile unless you turn off the ADO reference.
    Charlotte

  4. #4
    New Lounger
    Join Date
    Aug 2001
    Location
    Amarillo, Texas, USA
    Posts
    10
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Error Codes (Access 2K)

    Mark and Charlotte,

    Thank you very much for your help. <img src=/S/bravo.gif border=0 alt=bravo width=16 height=30>

Posting Permissions

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