Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here


Microsoft: Access Modules (VBA Coding) FAQ

Error Resolution

Runtime Layered Handling for Critical Procedures by scking
Posted: 29 Jul 05

I rely heavily on data from external sources.  When I can't control the quality of the data sometimes strange errors occur that I would rather handle and do analysis on at a later time.  The DEBUGON variable can be set on by developers during analysis.  This gives developers the additional abilility to chose easily during runtime ls about an error for the analyst/developer who must inspect the problem and allow data loads to continue. I stop it and examine the runtime copy of the variable but the snippet could easily be modified to log the results in a logfile including the recordset row at fault and press on.

This will only work properly if procedures called from within this procedure also have error handling, otherwise it would give a potentially false hit.  The final application code would handle all types of errors identified and DEBUGON could be set to false but be available for analysis.  I recommend you use it sparingly.

DIM DEBUGON As Boolean, LOGERR As Boolean, RESUMENEXT As Boolean

On Error GoTo HandleError

'... Code here

    '... Cleanup here
    Exit Sub

    ' Error checking Layer 1 (DEV DEBUG TEST)
    If MsgBox(Err.Description & vbCrLf _
        & "Do you want to Debug this error in GetElapsedTime?" _
        & "The processing should be completed.", _
        vbCritical + vbYesNo, "Data Load Notice") = vbYes Then
    End If
    End If
    ' Error Checking Layer 2 (Logging Error)
    If LOGERR Then
        Call HandleTheError("basDataMgmt", "GetElapsedTime", Err)
    End If

    ' Error Checking Layer 3 (Resume Next)
        Then Resume Next
    End If

    ' Error Checking Layer 4 (Stardard handling)
    Select Case Err.Number
        If 9 Then
            ' Handle the 9 case
            GoTo Exit_Proc
    End Select

Back to Microsoft: Access Modules (VBA Coding) FAQ Index
Back to Microsoft: Access Modules (VBA Coding) Forum

My Archive

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close