|
-
Sep 15th, 2000, 04:34 AM
#1
Thread Starter
Addicted Member
What I have here is code that lets a user change their password. I placed checks in the code to see where the problem is. The code reaches a certain stage and then jumps straight to the end. I need to place a few further checks in the code to see whats going on. The code doesn't reaches this line
Code:
Userss![Expiry Date] = Format$(Date + PasswordExpiry, "dd/mm/yyyy")
Can someone please try to help me out with this. I need to know how to check the details fo why it isn't working. Please help!!! Sorry for the large amount of code posted.
Code:
Dim Userss As dynaset
Dim UserAudit As Table
Dim DebugLog As String
DebugLog = AddSlash(CurDir) & "DebugJK.log"
iFreeFileNum = FreeFile
Open DebugLog For Append As #iFreeFileNum
Print #iFreeFileNum, "********************************************************************* "
Print #iFreeFileNum, "____Purpose of Logfile : To determine any errors in the CHANGEPW.FRM "
Print #iFreeFileNum, "Last modified: "; Now
Print #iFreeFileNum, "User Name :"; who.Name
Print #iFreeFileNum, "Your old Password was(Encrypt) :"; Userss!Password
Print #iFreeFileNum, "Your typed your old Password as(nonEncrypt) :"; TextOldPassword.Text
Print #iFreeFileNum, "Your new password was typed as :"; textnewPassword
Print #iFreeFileNum, "Your confirmed your new password as :"; TextConfirm.Text
Print #iFreeFileNum, "------------------------------------------------------------------------ "
Close #iFreeFileNum
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
Call logtofile(DebugLog, "Check 1: The oldPasswordCheck has been run successfully ")
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
Call logtofile(DebugLog, "Check 1.1: The Password is less that 6 chars, 'Password Change Dialog Box Appeared'")
Exit Sub
End If
Exit Sub
Else
'Call statements Call the Private Function logToFile, This Sub Writes to the log file
Userss.Edit
Call logtofile(DebugLog, "Check 2: The Editing of the UserName has Successfully Started")
Userss!Password = encode(CStr(who.Name), CStr(textnewPassword.Text))
Call logtofile(DebugLog, "Check 3: The Username and Password has been taken in ")
'This is as far as the code runs to. I need to find out, why? The check 3 runs fie but then it
'goes to Check 11: The Password change Failed. I need to put a check in here to find out what
'is going wrong. What can I do??????
Call logtofile
Userss![Expiry Date] = Format$(Date + PasswordExpiry, "dd/mm/yyyy")
Call logtofile(DebugLog, "Check 4: Date and password expiry has being passed")
Userss.Update
If AUDITING = True Then
Call logtofile(DebugLog, "Check 5: The Auditing Process has successfully started")
UserAudit.AddNew
Call logtofile(DebugLog, "Check 6: A new user field was entered in the UserAudit Table")
UserAudit![User Name] = who.Name
Call logtofile(DebugLog, "Check 7: The Username was brought in")
UserAudit!Password = "Changed"
Call logtofile(DebugLog, "Check 8: The Password was changed")
UserAudit![Expiry Date] = Format$(Date + PasswordExpiry, "dd/mm/yyyy")
'added by JK
Call logtofile(DebugLog, "Check 9:The Expiry Date was set for the New Password")
'end of JK
UserAudit!By = who.Name
UserAudit!Date = Format$(Date, "dd/mm/yyyy")
UserAudit!Time = Format$(Time, "Long Time")
UserAudit.Update
'added by JK
Call logtofile(DebugLog, "Check 10:The Update was successfully launched")
'end of JK
End If
MsgBox "Your password has been changed!", MB_ICONINFORMATION
Call logtofile(DebugLog, "Check 11: The password Change was successful, and the MsgBox Appeared")
iFreeFileNum = FreeFile
Open DebugLog For Append As #iFreeFileNum
Print #iFreeFileNum, "The New Password that you typed is: "; textnewPassword.Text
Print #iFreeFileNum, "The New Password (Encrypt) : "; Userss!Password
Print #iFreeFileNum, "********************************************************************* "
Print #iFreeFileNum, "********************************************************************* "
Print #iFreeFileNum, "********************************************************************* "
Close #iFreeFileNum
'end of JK
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
'added by JK
Call logtofile(DebugLog, "Check 11: The Password change Failed, and ")
'end of JK
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
Please help!!!!!!!!!!!
-
Sep 15th, 2000, 05:06 AM
#2
Frenzied Member
Why not put a breakpoint at the top of this section of code (using F9), then run the program - when the program stops at the breakpoint use F8 to step through it line by line. You will see then what it's up to. You can hold the mouse over variables to see what the value is in the variable etc.
If you still can't work out what's going wrong post the line where the error seems to be occuring to this group and we can all take another look.
'Buzby'
Visual Basic Developer
"I'm moving to Theory. Everything works there."
-
Sep 15th, 2000, 05:19 AM
#3
Thread Starter
Addicted Member
Thanks a lot for that. I don't actually get any errors at all when I run the code. I think that the problem is with variables on the following line. Or maybe with the Dynaset
Code:
Userss![Expiry Date] = Format$(Date + PasswordExpiry, "dd/mm/yyyy")
Is there any way to print these variables out to the log file so that I can see their values. I'm using vb3. Thanks a lot for the help
-
Sep 15th, 2000, 05:44 AM
#4
Frenzied Member
This won't work - you need to use the DateAdd function;
eg; to add 30 days to today's date;
Code:
NewDate = DateAdd("d",30,Now)
So, if PAsswordExpiry is the number of days you need to ;
Code:
Userss![Expiry Date] = Format$(DateAdd("d",PasswordExpiry,Date), "dd/mm/yyyy")
'Buzby'
Visual Basic Developer
"I'm moving to Theory. Everything works there."
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
|