Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / General 1 / May 2008

Tip: Looking for answers? Try searching our database.

Create Error List in VBA

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
RLN - 29 May 2008 17:18 GMT
Luke Chung at FMS Inc provide this link in another thread that provided
a really helpful .pdf file error listing:
http://www.fmsinc.com/MicrosoftAccess/Errors/ErrorNumberAccess2007-2000.
pdf

Does anyone have a VBA example where an error reference table contains
the error numbers and description of the errors listed in Luke's
document?

Thanks.
fredg - 29 May 2008 18:07 GMT
> Luke Chung at FMS Inc provide this link in another thread that provided
> a really helpful .pdf file error listing:
[quoted text clipped - 8 lines]
>
> *** Sent via Developersdex http://www.developersdex.com ***

That web page is no longer available.
Perhaps this is what you mean. It's from either the Access help files
(Access 97?) or an old Knowledgebase article. I can't remember.

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

Signature

Fred
Please respond only to this newsgroup.
I do not reply to personal e-mail

Stuart McCall - 29 May 2008 18:51 GMT
>> Luke Chung at FMS Inc provide this link in another thread that provided
>> a really helpful .pdf file error listing:
[quoted text clipped - 10 lines]
>
> That web page is no longer available.
<SNIP>

The page is ok but the mail system mangled the url. If you copy it all into
the address bar you'll get there.
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.