Create Error List in VBA

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • RLN

    Create Error List in VBA

    Luke Chung at FMS Inc provide this link in another thread that provided
    a really helpful .pdf file error listing:
    http://www.fmsinc.com/MicrosoftAcces...ccess2007-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.

    *** Sent via Developersdex http://www.developersdex.com ***
  • fredg

    #2
    Re: Create Error List in VBA

    On Thu, 29 May 2008 11:18:31 -0500, RLN wrote:
    Luke Chung at FMS Inc provide this link in another thread that provided
    a really helpful .pdf file error listing:
    http://www.fmsinc.com/MicrosoftAcces...ccess2007-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.
    >
    *** 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 AccessAndJetErr orsTable() As Boolean
    Dim dbs As Database, tdf As TableDef, fld As Field
    Dim rst As Recordset, lngCode As Long
    Dim strAccessErr As String
    Const conAppObjectErr or = "Applicatio n-defined or object-defined
    error"

    On Error GoTo Error_AccessAnd JetErrorsTable
    ' Create Errors table with ErrorNumber and ErrorDescriptio n
    fields.
    Set dbs = CurrentDb
    Set tdf = dbs.CreateTable Def("AccessAndJ etErrors")
    Set fld = tdf.CreateField ("ErrorCode" , dbLong)

    tdf.Fields.Appe nd fld
    Set fld = tdf.CreateField ("ErrorStrin g", dbMemo)
    tdf.Fields.Appe nd fld

    dbs.TableDefs.A ppend tdf
    ' Open recordset on Errors table.
    Set rst = dbs.OpenRecords et("AccessAndJe tErrors")
    ' Loop through error codes.
    For lngCode = 0 To 5000
    On Error Resume Next
    ' Raise each error.
    strAccessErr = AccessError(lng Code)
    DoCmd.Hourglass True
    ' Skip error numbers without associated strings.
    If strAccessErr <"" Then

    ' Skip codes that generate application or object-defined errors.
    If strAccessErr <conAppObjectEr ror 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
    RefreshDatabase Window
    MsgBox "Access and Jet errors table created."

    AccessAndJetErr orsTable = True

    Exit_AccessAndJ etErrorsTable:
    Exit Function

    Error_AccessAnd JetErrorsTable:
    MsgBox Err & ": " & Err.Description
    AccessAndJetErr orsTable = False
    Resume Exit_AccessAndJ etErrorsTable
    End Function

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

    Comment

    • Stuart McCall

      #3
      Re: Create Error List in VBA

      "fredg" <fgutkind@examp le.invalidwrote in message
      news:15uh3lj3v0 5rv.dwgec6iejb6 c.dlg@40tude.ne t...
      On Thu, 29 May 2008 11:18:31 -0500, RLN wrote:
      >
      >Luke Chung at FMS Inc provide this link in another thread that provided
      >a really helpful .pdf file error listing:
      >http://www.fmsinc.com/MicrosoftAcces...ccess2007-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.
      >>
      >*** Sent via Developersdex http://www.developersdex.com ***
      >
      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.


      Comment

      Working...