|
-
Aug 29th, 2000, 03:31 AM
#1
Thread Starter
Addicted Member
Hi guys,
What I'm trying to do write to a log file. The code here is part of my application that allows a user to change their password. The problem that I have is that the when the user changes their password for the first time the initial part of the code works and Prints some text to the log file, but that is the only thing that gets Printed. Could someone please tell me how go about putting some code in that will let me know in the log file when each stage of the code is executed. I need help really badly,
Thanks a lot
JK
Code:
Sub ComOK_Click()
On Error GoTo ChangePW_ComOK_Click_Err
'Creates a log file called DebugJK.log
'If you want to open the file from the CURRENT directory:
'added general function called AddSlash
filenum = FreeFile
Open AddSlash(CurDir) & "DebugJK.log" For Append As #filenum
Print #filenum, "____Purpose of Logfile____: To determine any errors in the CHANGEPW.FRM "
Print #filenum, "Last modified: "; Now
Print #filenum, "By: "; who.Name
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
Print #filenum, "CheckPoint1: The oldPasswordCheck has been run successfully"
Close #filenum
Open AddSlash(CurDir) & "DebugJK.log" For Append As #filenum
If Len(TextNewPassword.Text) < 6 Then
Text = messageList(30) ' Password must have at least 6 characters
Print #filenum, "Checkpoint 2: If the Password Typed is under 6 characters, this will appear in the logfile"
Close #filenum
Open AddSlash(CurDir) & "DebugJK.log" For Append As #filenum 'Reopens the Debug log
MsgBox Text, MB_ICONEXCLAMATION, "Password Change"
TextNewPassword.Text = ""
TextConfirm.Text = ""
TextNewPassword.SetFocus
Print #filenum, "Checkpoint 3: If the Password Change Message box has appeared, this will appear in the logfile"
Close #filenum
Exit Sub
End If
Else
Open AddSlash(CurDir) & "DebugJK.log" For Append As #filenum 'Reopens the Debug log
UserSS.Edit
UserSS!Password = encode(CStr(who.Name), CStr(TextNewPassword.Text))
Print #filenum, "The old Password has been Opened for edit and the Username has been associated with the new password"
UserSS![Expiry Date] = Format$(Date + PasswordExpiry, "dd/mm/yyyy")
Print #filenum, "The Expiry Date been set"
UserSS.Update
Print #filenum, "The new User Password has been Updated."
Close #filenum
If AUDITING = True Then
Open AddSlash(CurDir) & "DebugJK.log" For Append As #filenum 'Reopens the Debug log
Print #filenum, "This Confirms that the auditing Process has been started"
UserAudit.AddNew
'The Auditing Process has been started
UserAudit![User Name] = who.Name
Print #filenum, " The user name has been retrieved and put into the Variable [User Name]"
UserAudit!Password = "Changed"
Print #filenum, "The Password has been Changed"
UserAudit![Expiry Date] = Format$(Date + PasswordExpiry, "dd/mm/yyyy")
Print #filenum, "The Expiry Date has Been set"
UserAudit!By = who.Name
Print #filenum, "User Name, Who is Changing their password: "; who.Name
UserAudit!Date = Format$(Date, "dd/mm/yyyy")
Print #filenum, "Date, "; Format$(Date, "dd/mm/yyyy")
UserAudit!Time = Format$(Time, "Long Time")
Print #filenum, "Time?"; Format$(Time, "Long Time")
UserAudit.Update
Print #filenum, "The User Audit Has Successfully passed through all states."
Close #filenum
End If
Open AddSlash(CurDir) & "DebugJK.log" For Append As #filenum 'Reopens the Debug log
MsgBox "Your password has been changed!", MB_ICONINFORMATION
Print #filenum, "The Message Box to display that the Password has Successfully changed has been displayed"
Close #flienum
End If
Else
MsgBox "You must enter the old password!", MB_ICONEXCLAMATION
TextOldPassword.Text = ""
TextNewPassword.Text = ""
TextConfirm.Text = ""
TextOldPassword.SetFocus
Exit Sub
End If
ChangePW.Hide
ChangePW_ComOK_Click_Res:
Exit Sub
ChangePW_ComOK_Click_Err:
If Erl = 25 Then
Text = "Password change failed! Try again!"
MsgBox Text, MB_ICONEXCLAMATION, "Password Change"
TextOldPassword.Text = ""
TextNewPassword.Text = ""
TextConfirm.Text = ""
TextOldPassword.SetFocus
Resume ChangePW_ComOK_Click_Res
Else
MsgBox " Error " + CStr(Err) + " " + Error$(Err)
z% = LogError("COMOK Password Change", " Error " + CStr(Err) + " " + Error$(Err))
End
End If
End Sub
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|