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 MikeeOK on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Seeking Info on Error code descriptions 1

Status
Not open for further replies.

HiBoo

Programmer
Jan 11, 2000
88
CA
Is anyone aware of a place where I can locate information on error codes.&nbsp;&nbsp;<br><br>For example, I know that DataErr 2279 captures Input mask errors.(Right???)&nbsp;&nbsp;I'd like to know if there is documentation on all the DataErr code's in Access?&nbsp;&nbsp;I've tried to locate this information in the help facilities but have not located the info I need.&nbsp;&nbsp;I'm looking for a description of each Error number available to trap.<br><br>I'm trapping the errors in code through Form_Error.<br><br><br>Thanks in advance...
 
I found this out there on the web somewhere.&nbsp;&nbsp;It creates a table that you can query to look up errors.<br><br><br>Function AccessAndJetErrorsTable() As Boolean<br>&nbsp;&nbsp;&nbsp;&nbsp;Dim dbs As Database, tdf As TableDef, fld As Field<br>&nbsp;&nbsp;&nbsp;&nbsp;Dim rst As Recordset, lngCode As Long<br>&nbsp;&nbsp;&nbsp;&nbsp;Dim strAccessErr As String<br>&nbsp;&nbsp;&nbsp;&nbsp;Const conAppObjectError = &quot;Application-defined or object-defined error&quot;<br><br>&nbsp;&nbsp;&nbsp;&nbsp;On Error GoTo Error_AccessAndJetErrorsTable<br>&nbsp;&nbsp;&nbsp;&nbsp;' Create Errors table with ErrorNumber and ErrorDescription fields.<br>&nbsp;&nbsp;&nbsp;&nbsp;Set dbs = CurrentDb<br>&nbsp;&nbsp;&nbsp;&nbsp;Set tdf = dbs.CreateTableDef(&quot;AccessAndJetErrors&quot;)<br>&nbsp;&nbsp;&nbsp;&nbsp;Set fld = tdf.CreateField(&quot;ErrorCode&quot;, dbLong)<br><br>tdf.Fields.Append fld<br>&nbsp;&nbsp;&nbsp;&nbsp;Set fld = tdf.CreateField(&quot;ErrorString&quot;, dbMemo)<br>&nbsp;&nbsp;&nbsp;&nbsp;tdf.Fields.Append fld<br><br>&nbsp;&nbsp;&nbsp;&nbsp;dbs.TableDefs.Append tdf<br>&nbsp;&nbsp;&nbsp;&nbsp;' Open recordset on Errors table.<br>&nbsp;&nbsp;&nbsp;&nbsp;Set rst = dbs.OpenRecordset(&quot;AccessAndJetErrors&quot;)<br>&nbsp;&nbsp;&nbsp;&nbsp;' Loop through error codes.<br>&nbsp;&nbsp;&nbsp;&nbsp;For lngCode = 0 To 3500<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;On Error Resume Next<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;' Raise each error.<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;strAccessErr = AccessError(lngCode)<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;DoCmd.Hourglass True<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;' Skip error numbers without associated strings.<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;If strAccessErr &lt;&gt; &quot;&quot; Then<br><br>' Skip codes that generate application or object-defined errors.<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;If strAccessErr &lt;&gt; conAppObjectError Then<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;' Add each error code and string to Errors table.<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;rst.AddNew<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;rst!ErrorCode = lngCode<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;' Append string to memo field.<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;rst!ErrorString.AppendChunk strAccessErr<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;rst.Update<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;End If<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;End If<br>&nbsp;&nbsp;&nbsp;&nbsp;Next lngCode<br>&nbsp;&nbsp;&nbsp;&nbsp;' Close recordset.<br>&nbsp;&nbsp;&nbsp;&nbsp;rst.Close<br>&nbsp;&nbsp;&nbsp;&nbsp;DoCmd.Hourglass False<br>&nbsp;&nbsp;&nbsp;&nbsp;RefreshDatabaseWindow<br>&nbsp;&nbsp;&nbsp;&nbsp;MsgBox &quot;Access and Jet errors table created.&quot;<br><br>AccessAndJetErrorsTable = True<br><br>Exit_AccessAndJetErrorsTable:<br>&nbsp;&nbsp;&nbsp;&nbsp;Exit Function<br><br>Error_AccessAndJetErrorsTable:<br>&nbsp;&nbsp;&nbsp;&nbsp;MsgBox Err & &quot;: &quot; & Err.Description<br>&nbsp;&nbsp;&nbsp;&nbsp;AccessAndJetErrorsTable = False<br>&nbsp;&nbsp;&nbsp;&nbsp;Resume Exit_AccessAndJetErrorsTable<br>End Function<br><br><br><br>PaulF
 
Thanks PaulF!&nbsp;&nbsp;That's exactly what I'm looking for!!!
 
There are also some topics in the on-line help.&nbsp;&nbsp;Look under &quot;Trappable Errors&quot; and &quot;Trappable Microsoft Jet and DAO Errors&quot;.<br><br>The Function that PaulF posted is also included in the On-line help, but I can't remember the topic heading.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top