Okay, I found the code but it doesn't run in Access XP. I don't want to
print the error list I want to store it in a table. The below gives me a
runtime 13 where indicated and stops there. Can someone tell me what is
wrong? Thanks in advance... Gina
Sub CreateErrorsTable()
Dim dbs As Database, tdf As TableDef, fld As Field
Dim rst As Recordset, lngCode As Long
Const conAppObjectError = "Application-defined or object-defined error"
' Create Errors table with ErrorNumber and ErrorDescription fields.
Set dbs = CurrentDb
Set tdf = dbs.CreateTableDef("Errors")
Set fld = tdf.CreateField("ErrorCode", dbLong) RUNTIME 13
tdf.Fields.Append fld
Set fld = tdf.CreateField("ErrorString", dbText, 255)
tdf.Fields.Append fld
dbs.TableDefs.Append tdf
' Open recordset on Errors table.
Set rst = dbs.OpenRecordset("Errors")
' Loop through first 1000 Visual Basic error codes.
For lngCode = 1 To 1000
On Error Resume Next
' Raise each error.
Err.Raise lngCode
DoCmd.Hourglass True
' Skip error codes that generate application or object-defined
errors.
If Err.Description <> conAppObjectError Then
' Add each error code and string to Errors table.
rst.AddNew
rst!ErrorCode = Err.Number
rst!ErrorString = Err.Description
rst.Update
End If
' Clear Err object.
Err.Clear
Next lngCode
' Close recordset.
rst.Close
DoCmd.Hourglass False
MsgBox "Errors table created."
End Sub