borderAndreaVB free resources for Visual Basic developersborder

AndreaVB Visual Basic and VB.NET source code resources - Copyright © 1999-2008 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 04-06-2008 adLockOptimistic by aminchar
icon 23-11-2007 Re: Placing images and text on a crystal report by rays
icon 29-10-2007 VB file storage problem...help!!! by Rockter
icon 01-10-2007 Help with Image links in Db, please by wiseguy2004
icon 04-04-2007 error in word VBA to automate creation of mailing labels by dgr7
Partners: Il portale per lui e lei | Download Actual Software | Free Software Download
borderAndreaVB free resources for Visual Basic developersborder

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