Connecting Tech Pros Worldwide Forums | Help | Site Map

Listing of Access 2003 error codes?

PW
Guest
 
Posts: n/a
#1: Nov 2 '06
Hi,

There is code in Alison Balter's excellant "Mastering Access 2003" to
create a list of error codes and descriptions but it only generates
error messages 3 through 94. Is there a website with a list of all of
the error messages (with descriptions?).

Thanks,

-paul

ruralguy via AccessMonster.com
Guest
 
Posts: n/a
#2: Nov 3 '06

re: Listing of Access 2003 error codes?


I don't remember where I got this code. If you recognize your code, let me
know and I'll add it to the code.

-----------------------------------
Function AccessAndJetErrorsTable() As Boolean

Dim dbs As DAO.Database, tdf As TableDef, fld As 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
---------------------------------------------

PW wrote:
Quote:
>Hi,
>
>There is code in Alison Balter's excellant "Mastering Access 2003" to
>create a list of error codes and descriptions but it only generates
>error messages 3 through 94. Is there a website with a list of all of
>the error messages (with descriptions?).
>
>Thanks,
>
>-paul
--
HTH - RuralGuy (RG for short) acXP WinXP Pro
Please post back to this forum so all may benefit.

Message posted via http://www.accessmonster.com

PW
Guest
 
Posts: n/a
#3: Nov 3 '06

re: Listing of Access 2003 error codes?


On Fri, 03 Nov 2006 00:20:30 GMT, "ruralguy via AccessMonster.com"
<u12102@uwewrote:
Quote:
>I don't remember where I got this code. If you recognize your code, let me
>know and I'll add it to the code.
>
>-----------------------------------
>Function AccessAndJetErrorsTable() As Boolean
>
>Dim dbs As DAO.Database, tdf As TableDef, fld As 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
>---------------------------------------------
>
Looks almost identical, except she loops through 10,000. I will give
it a shot. Thanks!

-pw
Quote:
>PW wrote:
Quote:
>>Hi,
>>
>>There is code in Alison Balter's excellant "Mastering Access 2003" to
>>create a list of error codes and descriptions but it only generates
>>error messages 3 through 94. Is there a website with a list of all of
>>the error messages (with descriptions?).
>>
>>Thanks,
>>
>>-paul
PW
Guest
 
Posts: n/a
#4: Nov 14 '06

re: Listing of Access 2003 error codes?


On Fri, 03 Nov 2006 00:20:30 GMT, "ruralguy via AccessMonster.com"
<u12102@uwewrote:
Quote:
>I don't remember where I got this code. If you recognize your code, let me
>know and I'll add it to the code.
>
>-----------------------------------
>Function AccessAndJetErrorsTable() As Boolean
>
>Dim dbs As DAO.Database, tdf As TableDef, fld As 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
>---------------------------------------------
>
>PW wrote:
Quote:
>>Hi,
>>
>>There is code in Alison Balter's excellant "Mastering Access 2003" to
>>create a list of error codes and descriptions but it only generates
>>error messages 3 through 94. Is there a website with a list of all of
>>the error messages (with descriptions?).
>>
>>Thanks,
>>
>>-paul
Quote:
Quote:
>>AccessAndJetErrorsTable = True
This returns "function call on left-hand side of assignment must
return variant or object".

And, I can't find the table "AccessAndJetErrors"

-pw
ruralguy via AccessMonster.com
Guest
 
Posts: n/a
#5: Nov 14 '06

re: Listing of Access 2003 error codes?


Are you calling it from the immediate window with:
?AccessAndJetErrorsTable()

What version of Access are you using?

PW wrote:
Quote:
Quote:
>>I don't remember where I got this code. If you recognize your code, let me
>>know and I'll add it to the code.
>[quoted text clipped - 63 lines]
Quote:
Quote:
>>>
>>>-paul
>
Quote:
Quote:
>>>AccessAndJetErrorsTable = True
>
>This returns "function call on left-hand side of assignment must
>return variant or object".
>
>And, I can't find the table "AccessAndJetErrors"
>
>-pw
--
HTH - RuralGuy (RG for short) acXP WinXP Pro
Please post back to this forum so all may benefit.

Message posted via http://www.accessmonster.com

Granny Spitz via AccessMonster.com
Guest
 
Posts: n/a
#6: Nov 14 '06

re: Listing of Access 2003 error codes?


ruralguy wrote:
Quote:
I don't remember where I got this code. If you recognize your code, let me
know and I'll add it to the code.
It's from Access 97 Help, as modified when Access 2000 came out, because
Recordset needed to be changed to DAO.Recordset to disambiguate it from ADODB.
Recordset, the default for Access 2000 and 2002.

--
Message posted via http://www.accessmonster.com

ruralguy via AccessMonster.com
Guest
 
Posts: n/a
#7: Nov 14 '06

re: Listing of Access 2003 error codes?


Thanks Granny. Attribute added.

Granny Spitz wrote:
Quote:
Quote:
>I don't remember where I got this code. If you recognize your code, let me
>know and I'll add it to the code.
>
>It's from Access 97 Help, as modified when Access 2000 came out, because
>Recordset needed to be changed to DAO.Recordset to disambiguate it from ADODB.
>Recordset, the default for Access 2000 and 2002.
--
HTH - RuralGuy (RG for short) acXP WinXP Pro
Please post back to this forum so all may benefit.

Message posted via http://www.accessmonster.com

PW
Guest
 
Posts: n/a
#8: Nov 15 '06

re: Listing of Access 2003 error codes?


On Tue, 14 Nov 2006 19:32:03 GMT, "ruralguy via AccessMonster.com"
<u12102@uwewrote:
Quote:
>Are you calling it from the immediate window with:
>?AccessAndJetErrorsTable()
>
>What version of Access are you using?
2003. I put the code behind a command button on a form. Do I save the
code as a module first?

Quote:
>
>PW wrote:
Quote:
Quote:
>>>I don't remember where I got this code. If you recognize your code, let me
>>>know and I'll add it to the code.
>>[quoted text clipped - 63 lines]
Quote:
>>>>
>>>>-paul
>>
Quote:
>>>>AccessAndJetErrorsTable = True
>>
>>This returns "function call on left-hand side of assignment must
>>return variant or object".
>>
>>And, I can't find the table "AccessAndJetErrors"
>>
>>-pw
ruralguy via AccessMonster.com
Guest
 
Posts: n/a
#9: Nov 15 '06

re: Listing of Access 2003 error codes?


It is a function and returns a boolean value. Therefore use
Junk = AccessAndJetErrorsTable()
...to invoke the function from a command button.

PW wrote:
Quote:
Quote:
>>Are you calling it from the immediate window with:
>>?AccessAndJetErrorsTable()
>>
>>What version of Access are you using?
>
>2003. I put the code behind a command button on a form. Do I save the
>code as a module first?
>
Quote:
Quote:
>>>>I don't remember where I got this code. If you recognize your code, let me
>>>>know and I'll add it to the code.
>[quoted text clipped - 10 lines]
Quote:
Quote:
>>>
>>>-pw
--
HTH - RuralGuy (RG for short) acXP WinXP Pro
Please post back to this forum so all may benefit.

Message posted via http://www.accessmonster.com

Closed Thread


Similar Microsoft Access / VBA bytes