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