Here's a part of my code. What I'm trying to do is put checkpoints at certain stages of my code that will Print a line of text to my log file stating that the code has at that particular point has executed correctly. Do I have to reopen the log file each time I want to do a check. I've only started VB this week and am still a bit lost. Any help would be greatly appreciated.

Thanks a lot.





Sub ComOK_Click ()
On Error GoTo ChangePW_ComOK_Click_Err
'Code by JK to investigate Password Errors
'Creates a log file called DebugJK.log
filenum = FreeFile
Open "C:\temp\DebugJK.log" For Append As #filenum
Print #filenum, "____Purpose of Logfile____: To determine any errors in the CHANGEPW.FRM "
Print #filenum, "Last modified: "; Now
'End JK
If TextOldPassword.Text <> "" Then
25 : UserSS.FindFirst ("[User Name] = '" + who.Name + "'")
enc$ = encode(CStr(who.Name), CStr(TextOldPassword.Text))
If (enc$ <> UserSS!Password) Or (who.Name <> UserSS![User Name]) Then Error 99
'Added JK
Print #filenum, "The oldPasswordCheck has been run successfully"
Close #filenum
' End JK
If Len(TextNewPassword.Text) < 6 Then
Text = messageList(30) ' Password must have at least 6 characters
MsgBox Text, MB_ICONEXCLAMATION, "Password Change"
TextNewPassword.Text = ""
TextConfirm.Text = ""
TextNewPassword.SetFocus
Exit Sub
End If