Computer Learning Zone CLZ Access Excel Word Windows

True science literacy is less about what you know and more about how your brain is wired for asking questions.

-Neil deGrasse Tyson
 
Home   Courses   Templates   Seminars   TechHelp   Forums   Help   Contact   Join   Order   Logon  
 
Home > TechHelp > Access >
Back to TechHelp    Comments List
Upload Images   @Reply   Bookmark    Link   Email  
UserT
Neil deGrasse Tyson 
     
3 months ago
Can someone please point me in the direction of the TechHelp video Richard did where he constructed a UserT? I'd like to rewatch it and see if he talks about how to track the first time a user logs into the database. Thanks!
Kevin Robertson  @Reply  
          
3 months ago
Daniel Golden OP  @Reply  
     
3 months ago
I think that's it Kevin. I realized just now that what I am trying to add to it is something in the code of the LogonBtn On Click event... Currently it checks for the last time a user's password was changed using this:

DateChaged = Nz(DLookup("DateChanged", "UserT", "Username=""" & TempVars("Username") & """"), #1/1/1990#)
    If Date - DateChaged > 90 Then
        MsgBox "Your password is more than 90 days old and must be changed now."
        DoCmd.OpenForm "PasswordChangeF"
    Else
        DoCmd.OpenForm "Main Menu"
    End If

I'd like to add in there somewhere for it to check if a new column I've added to the UserT ("FirstLogon") is null so that if it is, some other code can be run elsewhere.
Daniel Golden OP  @Reply  
     
3 months ago
Also, this is the code that runs in the passwordChangeF so I assume something like this would have to be added in somewhere:

Private Sub UpdateBtn_Click()

    Password2.SetFocus
    If IsNull(Password1) Then MsgBox ("Password 1 missing"): Exit Sub
    If IsNull(Password2) Then MsgBox ("Password 2 missing"): Exit Sub
    If Password1 <> Password2 Then MsgBox ("Passwords don't match!"): Exit Sub
    
    CurrentDb.Execute "UPDATE UserT " & _
        "SET Password=""" & Password1 & """, DateChanged=#" & Date & "# " & _
        "WHERE Username=""" & TempVars("Username") & """"
        MsgBox ("Password updated successfully!")
    
    DoCmd.OpenForm "Main Menu"
    DoCmd.Close acForm, Me.Name, acSaveYes

End Sub
Kevin Robertson  @Reply  
          
3 months ago
Have you watched this video?
Force Change Password
Daniel Golden OP  @Reply  
     
3 months ago
Yes, thats where I got the code listed above.
Daniel Golden OP  @Reply  
     
3 months ago
I added this:

If IsNull("UserT!FirstLogon") Then
        UserT!FirstLogon = Date
    End If

but it does not work.
Kevin Robertson  @Reply  
          
3 months ago
You need to look up the value of the field in the table. The code below assumes there is a record. You may need more if the user doesn't exist. I hard coded the UserID for simplicity and testing purposes.

Dim FirstLogon As String, UserID As Long
    
UserID = 1
FirstLogon = Nz(DLookup("FirstLogon", "UserT", "UserID=" & UserID), "")
    
If FirstLogon = "" Then
    CurrentDB.Execute "UPDATE UserT SET FirstLogon=#" & Date & "# WHERE UserID=" & UserID
End If
Daniel Golden OP  @Reply  
     
3 months ago
Kevin, you sir, are a GENIUS! Thank you so much!
Kevin Robertson  @Reply  
          
3 months ago
You're welcome.
Sami Shamma  @Reply  
              
3 months ago
Daniel, Kevin Robertson is a true GENIUS

This thread is now CLOSED. If you wish to comment, start a NEW discussion in TechHelp.
 

 
 
 

The following is a paid advertisement
Computer Learning Zone is not responsible for any content shown or offers made by these ads.
 

Learn
 
Access - index
Excel - index
Word - index
Windows - index
PowerPoint - index
Photoshop - index
Visual Basic - index
ASP - index
Seminars
More...
Customers
 
Login
My Account
My Courses
Lost Password
Memberships
Student Databases
Change Email
Info
 
Latest News
New Releases
User Forums
Topic Glossary
Tips & Tricks
Search The Site
Code Vault
Collapse Menus
Help
 
Customer Support
Web Site Tour
FAQs
TechHelp
Consulting Services
About
 
Background
Testimonials
Jobs
Affiliate Program
Richard Rost
Free Lessons
Mailing List
PCResale.NET
Order
 
Video Tutorials
Handbooks
Memberships
Learning Connection
Idiot's Guide to Excel
Volume Discounts
Payment Info
Shipping
Terms of Sale
Contact
 
Contact Info
Support Policy
Mailing Address
Phone Number
Fax Number
Course Survey
Email Richard
[email protected]
Blog RSS Feed    YouTube Channel

LinkedIn
Copyright 2025 by Computer Learning Zone, Amicron, and Richard Rost. All Rights Reserved. Current Time: 5/22/2025 4:56:43 PM. PLT: 1s