Results 1 to 4 of 4

Thread: Password Expiration Warning message

Threaded View

  1. #1

    Thread Starter
    New Member
    Join Date
    Sep 2010
    Posts
    2

    Question Password Expiration Warning message

    Hi All,

    Please I need help with the vb script below. I wanted it to prompt users when their password is about expiring and on answering Yes, it should open a form frmChangepassword, hold it until the user enter a new password and save.
    Right now, it opens the form without holding it, but goes on to open the second form Switchboard. When i close switchboard then the changepassword form will show behind the login1 form.
    vb Code:
    1. Private Sub fdate_Exit(Cancel As Integer)
    2. If IsNull(Forms![login1]![fname]) Or IsNull(Forms![login1]![fpassword]) Then
    3.     MsgBox ("Unauthorised User")
    4. Else
    5.     If Forms![login1]![fdate] > Now() Or IsNull(Forms![login1]![fdate]) Then
    6.         MsgBox ("Date is in the future or Cannot Be Blank")
    7.     Else
    8.         If IsNull(Forms![login1]![Ulevel]) Then
    9.            MsgBox ("User Does Not Exist or Password Is Not Correct")
    10.            fname = ""
    11.            fpassword = ""
    12.            fname.SetFocus
    13.            Exit Sub
    14.         Else
    15.             '********
    16.             '**  The following statements check for password aging / expiring
    17.             If DateDiff("d", gDate, Now) > gPasswordAge Then
    18.               MsgBox "Password has expired, please change your password"
    19.               gStatus = "Expired"
    20.               DoCmd.OpenForm "frmchangepassword", acNormal, , , , acWindowNormal
    21.               Exit Sub
    22.             End If
    23.             ' If DateDiff("d", gDate, Now) > 30 Then MsgBox "Your passord will expire in " & Str$(46 - DateDiff("d", gDate, Now)) & " days !"
    24.            
    25.             'This is where am having problem with''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
    26.            
    27.               Dim Reply As String
    28.             If DateDiff("d", gDate, Now) > (gPasswordAge - 15) Then
    29.                 Reply = MsgBox("Your password will expire in " & Str$((gPasswordAge + 1) - DateDiff("d", gDate, Now)) & " days !,Do you want to change it now?", vbYesNo)
    30.             End If
    31.            
    32.             If Reply = vbYes Then
    33.                 DoCmd.OpenForm "frmChangePassword", acNormal, , , , acWindowNormal, vbModal
    34.              
    35.             Else
    36.                DoCmd.OpenForm "switchboard", acNormal, , , , acWindowNormal
    37.                Exit Sub
    38.             End If
    39.            
    40.             '***** End of password / expiring aging verification
    41.             gUserID = ""
    42.             If Forms![login1]![Ulevel] = "2" Then
    43.             'DoCmd.OpenForm ("SelectReport")
    44.                
    45.                DoCmd.OpenForm ("switchboard")
    46.             Else
    47.                DoCmd.OpenForm ("switchboard")
    48.                Me.AllowEdits = True
    49.                Me.AllowAdditions = False
    50.             End If
    51.         End If
    52.     End If
    53. End If
    54. Forms.Item("login1").Properties.Item("visible") = False
    55. End Sub
    Last edited by Hack; Sep 2nd, 2010 at 01:20 PM. Reason: Added Highlight Tags And Indenting

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width