Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

List of all Error Numbers and their descriptions

Status
Not open for further replies.

aarondewberry

IS-IT--Management
Jul 20, 2005
148
0
0
GB
Hi

I have been trawling the net for an age and cannot find a comprehensive list of all the error numbers, and their descriptions, that can occur within Access.

Does anyone have a list or....?

Many thanks
 
I know of no static list, although there obviously must be at least a collection = somewhere. Since the errors them selves are generated by the various objects including addins, I do not think there even CAN be a single comprehensive list.

For a sample list:

For xx = 1 to 100: ? xx, Error(xx): next xx

you will note that every in this simplistic exercise, many of the descriptions are "Application-defined or object-defined error" The lower bound used here is one (1), because err(0) is defined as no error. I do not know the upper bound, buy is at least 65K, so be prepared to spend a while waiting for any procedure you base on this concept to take a while.

Further, the immediate window usually holds only a hundred lines, so to get any reasonable list, you will want to place the output elsewhere ...



MichaelRed


 
This is not mine, and I cannot remember the author.

Code:
Function AccessAndJetErrorsTable() As Boolean
'Keywords: Error Codes Error Messages Error Numbers
    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

 
Brillaint.. thanks for the response guys.

Remou that code works a treat. Thanks
 
Remou, I'd use this:
Code:
With rst
  For lngCode = 0 To 32767
    If Trim(AccessError(lngCode) & "") <> conAppObjectError _
    And Trim(AccessError(lngCode) & "") <> "" Then
      .AddNew
      !ErrorCode = lngCode
      !ErrorString = AccessError(lngCode)
      .Update
    ElseIf Trim(Error(lngCode) & "") <> conAppObjectError _
    And Trim(Error(lngCode) & "") <> "" Then
      .AddNew
      !ErrorCode = lngCode
      !ErrorString = Error(lngCode)
      .Update
    End If
  Next lngCode
End With

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
I think Remou and / or PHV deserve you "Appreciation" (e.g. stars).

After all, both supplied a canned solution.



MichaelRed


 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top