Free Lessons
Courses
Seminars
TechHelp
Fast Tips
Templates
Topic Index
Forum
ABCD
 
Home   Courses   Index   Templates   Seminars   TechHelp   Forums   Help   Contact   Join   Order   Logon  
 
Home > TechHelp > Directory > Access > User Level Security 1 < Data Types | User Level Security 2 >
Back to User Level Security    Comments List
Upload Images   Link   Email  
User Name and password code
Eric McQuistan 
      
14 months ago
I built a username and password form like the one in the tech help video "User level Security" and wrote the code exactly as it was in the video. When I was setting up the users in the user table, I left the password blank and figured I would add them later. When I added some passwords and tested again it would allow me to log in with just the username. I didn't have to enter the password that was in the table, I could just leave it blank and it would still logon. I went back to the video to see if that combination had been tested in the video and it hadn't been. I am just getting started with code writing and do not have enough experience to know why this is happening. I included the code that I wrote for my button below. Can someone test this for me to see how I need to change it so the password has to be entered if there is a password in the table.

Private Sub LogOnBtn_Click()
    Dim ID As Long, PW As String
    
    ID = Nz(DLookup("UserID", "UserT", "UserName=""" & UserName & """"), 0)
    If ID = 0 Then
        MsgBox "User not found"
        Quit
    End If
    
    PW = Nz(DLookup("Password", "UserT", "UserID=" & ID), "")
    If PW <> Password Then
        MsgBox "Incorrect Password"
        Quit
    End If
    
    TempVars("UserName") = UserName.Value
    DoCmd.OpenForm "UserF"
    DoCmd.Close acForm, Me.Name, acSaveYes
End Sub
Kevin Robertson 
           
14 months ago
See this thread for a solution: User Level Security
Eric McQuistan OP 
      
14 months ago
Thank you for your help!

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

 
 
 

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 2024 by Computer Learning Zone, Amicron, and Richard Rost. All Rights Reserved. Current Time: 12/13/2024 5:46:17 PM. PLT: 1s