borderAndreaVB free resources for Visual Basic developersborder

AndreaVB Visual Basic and VB.NET source code resources - Copyright © 1999-2012 Andrea Tincani
:: Save an Error log File

Author  

Robert Smith & Brian Hoffleith

Language  

VB5, VB6

Operating Systems  

Windows 95, 98 and NT
Module

'The following code shows how one can record errors to a Errors.log file.
'Create an Errors.log file first and place that file in your apps path.
'Place the error handling in whatever procedures you want.
'Place the errLogger procedure in a module as a public procedure
'or in a form as a private procedure.


Public Sub errLogger(ByVal lNum As Long, ByVal sDesc As String, ByVal sFrom As String)
    Dim FileNum As Integer

    FileNum = FreeFile
    Open App.Path & "\Errors.log" For Append As FileNum
    Write #FileNum, lNum, sDesc, sFrom, Now()
    Close FileNum
End Sub

Usage

'Usage:
Private Sub butGenErr_Click()
    On Error GoTo Err_handler

    Exit Sub
Err_handler:
    If Err.Number <> 0 Then
        errLogger Err.Number, Err.Description, "butGenErr_Click"
        Err.Clear
        Resume Next
    End If
End Sub

:: Navigation

Home

Files and Disks Tips

Previous Tip

Next Tip

:: Search this site
Google
:: Related Topics
icon 27-12-2011 Export to Excel from Access Error by gosamerone
icon 07-11-2011 PDF by karl93
icon 30-12-2009 Re: Need help with code by txtimpact
icon 08-12-2009 Re: Need help with code by en973
icon 04-12-2009 Re: Need help with code by GeoffS
Partners: Download Actual Software | Free Software Download
borderAndreaVB free resources for Visual Basic developersborder

borderAndreaVB Visual Basic and VB.NET source code resources - Copyright © 1999-2012 Andrea Tincaniborder