Error Code List (1 Viewer)

LaurieW

Registered User.
Local time
Today, 15:51
Joined
May 9, 2002
Messages
99
Does anyone know where I can find a list of error codes for Access? A user had a problem in one of my databases today. When I compacted/repaired it using Access' utility I received these errors in a table called MSysCompactError:

-1206 Could not find field 'Description'
-1053 Could not find field 'Description'

I compacted again and did not receive these errors, so I think the database is fine. I would just like to look these up to see if I can get more information on what they mean. Also, I'm sure it would be helpful to have an error list for the future.

Thanks!
Laurie
 

pdx_man

Just trying to help
Local time
Today, 12:51
Joined
Jan 23, 2001
Messages
1,347
Go to one of your code modules and select Debug, Compile All Modules. Sounds to me like you have an something invalid in your code. I do have a list of all error codes, it is 1,068 rows, and these are not listed, I believe, because they are specific to your written code.
 

Pat Hartman

Super Moderator
Staff member
Local time
Today, 15:51
Joined
Feb 19, 2002
Messages
43,266
Here's a function that I got from a kb article that loads a table with all the Access errors. If the error number is not in this list, it is not coming from Access. You can just cut and paste it into a module. Then run it.

Code:
Function AccessAndJetErrorsTable() As Boolean
Dim dbs As DAO.Database, tdf As DAO.TableDef, fld As DAO.Field
Dim rst As DAO.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
 

LaurieW

Registered User.
Local time
Today, 15:51
Joined
May 9, 2002
Messages
99
Error List

Thanks for the code...I'll give it a try!
 

LaurieW

Registered User.
Local time
Today, 15:51
Joined
May 9, 2002
Messages
99
ErrorList; module won't run

I pasted the code you supplied into a module. When I try to compile it I get errors ... the first is:

User-defined type not defined

The piece of code "dbs as DAO.Database" is highlighted. I've tried figuring this out, but am stuck...I'm not an expert at debugging. Can you help?? When I type on a new line "Dim dbs As " from the list that comes up "DAO" is not available.

Thanks...
 

jfgambit

Kinetic Card Dealer
Local time
Today, 20:51
Joined
Jul 18, 2002
Messages
798
Laurie:

In your module goto Tools > References

Make sure the following is checked :

Microsoft DAO 3.6 object Library

HTH
 

LaurieW

Registered User.
Local time
Today, 15:51
Joined
May 9, 2002
Messages
99
Success

Ahhh, yes, that was it! Thank you!
 

IgorB

Registered User.
Local time
Today, 20:51
Joined
Jun 4, 2003
Messages
183
Add in References MS ADO 2.7 Ext for DLL and Security
Then paste code:

Dim cat As New ADOX.Catalog 'Data base Catalog
Dim tbl As New ADOX.Table
Dim cnn As ADODB.Connection
Dim rst As New ADODB.Recordset, lngCode As Long
Dim strAccessErr As String

Const conAppObjectError = "Application-defined or object-defined error"
On Error GoTo Error_AccessandJetErrorsTable

Set cnn = CurrentProject.Connection
'Create error
tbl.Name = "AccessAndJetErrors"
tbl.Columns.Append "ErrorCode", adInteger
tbl.Columns.Append "ErrorString", adLongVarWChar

Set cat.ActiveConnection = cnn
cat.Tables.Append tbl
rst.Open "AccessAndJetErrors", cnn, adOpenStatic, adLockOptimistic
For lngCode = 0 To 3500
On Error Resume Next
strAccessErr = AccessError(lngCode)
DoCmd.Hourglass True
If strAccessErr <> "" Then
If strAccessErr <> conAppObjectError Then
rst.AddNew
rst!ErrorCode = lngCode
rst!ErrorString = strAccessErr
rst.Update
End If
End If
Next lngCode
rst.Close
DoCmd.Hourglass False
RefreshDatabaseWindow
MsgBox "Access and Jet errors table created."

Exit_accessAndJetErrorsTable:
Exit Sub
Error_AccessandJetErrorsTable:
MsgBox Err & ": " & Err.Description
AccessAndJetErrorsTable = False
Resume Exit_accessAndJetErrorsTable
 

Pat Hartman

Super Moderator
Staff member
Local time
Today, 15:51
Joined
Feb 19, 2002
Messages
43,266
Igor's conversion to ADO caused me to look at the code again and I noticed the loop 1-3500. I decided to bump up the limit and there are over 300 more errors in the list. I bumped the upper limit to 5000.
 

Users who are viewing this thread

Top Bottom