| :: 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 |
|
 |
|
 |