MS-Access Error Reference

B

bcap

You can use the "Error()" or "AccessError()" function in the Immediate
window to get the description associated with an error number.

As for a reference that describes in detail the meaning of each error: you
are joking, right? Hell will freeze over before Microsoft ever documents
anything properly.
 
L

Linq Adams via AccessMonster.com

Here's a "How To" for creating a table with error codes/descriptions. I used
the table created as the basis for a tiny db where I enter the number and it
pulls up the description:

1. Create a new Access database (.mdb).
2. Create the following table:
Table: tblErrorsAndDescriptions
-------------------------------

Field Name: ErrorNumber
Data Type: Number
Indexed: Yes (No Duplicates)
Primary Key: Yes

Field Name: ErrorDescription
Data Type: Memo
3. Save the table as tblErrorsAndDescriptions.
4. Close the table.
5. Create a new module.
6. Type or paste the following code into the module:

Option Compare Database

Function sRecordAccessErrorMsg()

Dim ADOcnn As ADODB.Connection
Dim ADOrst As ADODB.Recordset

Dim intCounter As Long
Dim intErrornumber As Long
Dim strErrorText As String

Set ADOcnn = CurrentProject.Connection
Set ADOrst = New ADODB.Recordset

ADOrst.Open "tblErrorsAndDescriptions", ADOcnn, adOpenDynamic,
adLockOptimistic

With ADOrst
For intCounter = 0 To 32767
.AddNew
!ErrorNumber = intCounter
If IsNull(AccessError(intCounter)) Then
!ErrorDescription = "No Error"
ElseIf AccessError(intCounter) = "" Then
!ErrorDescription = "No Error"
Else
!ErrorDescription = AccessError(intCounter)
End If
.Update
Next intCounter
End With

MsgBox "Completed enumerating errors to the table."

End Function



7. Save the module as Module1.
8. Type the following line in the Immediate window, and then press ENTER:

sRecordAccessErrorMsg
 
Top