Results 1 to 8 of 8
  1. #1
    Jllera is offline Advanced Beginner
    Windows 7 64bit Access 2007
    Join Date
    Oct 2014
    Posts
    32

    Login script needs to update user password

    Hi All,



    I am trying to make my login form ask the user to update his/her password when they initially log in. The new password entered will be good for 90 days. How do I do this? Please give example (visual learner).

  2. #2
    rpeare is offline VIP
    Windows XP Access 2003
    Join Date
    Jul 2011
    Posts
    5,440
    You'd have to put a startdate and/or termination date on the login record and check that date against the current date to see if it has expired. If your usernames/passwords are being stored in a table in your database that would be the likely place to store the expiration date of the password. If you want to do something fancier, like keep track of all the passwords they have ever used so they can't use the same one again, you would need a secondary table that contained the PK (primary key) to the user table as a FK (foreign key) another unique identifier and the 'old' passwords with their expiration dates.

  3. #3
    Jllera is offline Advanced Beginner
    Windows 7 64bit Access 2007
    Join Date
    Oct 2014
    Posts
    32
    sweet! i'll give that a try and see if works. Thanks!!

  4. #4
    Jllera is offline Advanced Beginner
    Windows 7 64bit Access 2007
    Join Date
    Oct 2014
    Posts
    32
    Here is my login script. Where would I input the date/time for this to happen. Also I've added two fields in my login table; one is titled DateUpdated and the other is title ExpiredDate. Please advise.

    Private Sub OK_Click()
    If IsNull(Me.loginID.Value) = True Then
    MsgBox "Please enter LoginID", vbInformation, "LoginID Required"
    Me.loginID.SetFocus

    ElseIf IsNull(Me.Password.Value) = True Then
    MsgBox "Please enter Password", vbInformation, "Password Required"
    Me.Password.SetFocus

    Else
    'process the job
    If (IsNull(DLookup("LoginID", "Login and Password", "LoginID = '" & Me.loginID.Value & "'"))) Or _
    (IsNull(DLookup("Passwords", "Login and Password", "Passwords = '" & Me.Password.Value & "'"))) Then
    MsgBox "Incorrect LoginID or Password", vbCritical, "ERROR"

    Else
    DoCmd.OpenForm "Apogee Payment Systems", acNormal, , , acFormAdd
    DoCmd.Close acForm, "Login"
    End If
    End If
    End Sub

  5. #5
    rpeare is offline VIP
    Windows XP Access 2003
    Join Date
    Jul 2011
    Posts
    5,440
    where you put it depends totally on what you want your mechanic to be.

    Do you want to prevent them from logging in until they change it?

    Do you want to allow them to log in but be directed to a place to change their password?

    Do you want to allow them to change their password in the main login screen?

    If you have a specific form where they can change their login information (you want to make sure you hide the two date fields you mentioned so the users can't alter them) then I would put the date check portion of the login in the last ELSE loop check the date there like:

    Code:
    if date > dlookup("[ExpiredDate]", "Login and Password", "[LoginID] = '" & loginID & "'") then
        'do what you normally do
    else
        ' put in the code to direct them to enter a new password here
    endif

  6. #6
    Jllera is offline Advanced Beginner
    Windows 7 64bit Access 2007
    Join Date
    Oct 2014
    Posts
    32
    I want to prevent them from logging in until they change it. I also would like to allow them to change it from the main login screen. would this make the code you gave different?

  7. #7
    rpeare is offline VIP
    Windows XP Access 2003
    Join Date
    Jul 2011
    Posts
    5,440
    if you want them to change it from the main form you will have to provide two new fields for the new password/confirm new password

    In other words on a successful login but an expired password you would make the two 'new password' fields visible then confirm the changes (compare the two passwords first to make sure they are identical when you click a 'update password' button. The short answer is yes, the code would be in the same spot you just have to figure out the ELSE part of that statement.

  8. #8
    Jllera is offline Advanced Beginner
    Windows 7 64bit Access 2007
    Join Date
    Oct 2014
    Posts
    32
    rpeare you're awesome. I actually understand what you mean. lol.. I might how have to hit you up again to make I am entering the code correctly. I sometimes get stumped on how to write them. Thanks again.

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 1
    Last Post: 01-12-2015, 03:54 PM
  2. Replies: 4
    Last Post: 11-28-2014, 01:43 AM
  3. Replies: 2
    Last Post: 01-26-2013, 11:38 PM
  4. Problem with User Login and Password
    By sk88 in forum Access
    Replies: 3
    Last Post: 12-16-2011, 08:11 AM
  5. Login Script
    By theITguy in forum Access
    Replies: 2
    Last Post: 03-06-2009, 03:37 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums - Senior Forums