Save An Error Log File
'The user encounter errors in your program? do you want to know
'exactly he had? this is the code for you. the error will be saved in a file at your
'Insert the following code to your form:
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()
Private Sub Command1_Click()
On Error GoTo Err_handler
'The code for the Command Click event should be placed right here.
'The line below destined to make an error at your program, so you will be able to see
'the error log file.
Command1.Picture = LoadPicture("InvalidFile")
If Err.Number <> 0 Then
errLogger Err.Number, Err.Description, "Command1_Click"