Free Lessons
Courses
Seminars
TechHelp
Fast Tips
Templates
Topic Index
Forum
ABCD
 
Home   Courses   TechHelp   Forums   Help   Contact   Merch   Join   Order   Logon  
 
Back to Simple Security    Comments List
Upload Images   @Reply   Bookmark    Link   Email   Next Unseen 
Simple Security Allowing Access with Blank Pw
Anthony deGroot 
      
7 months ago
I have watch the Simple Security Video, and tried to set it up in my DB.  Following the VBA code in the video (change some items due to Table names) and for the most part is works.
- Enter a wrong UserID and the database closes
- Enter a wrong Password and the database closes
- Enter the correct UserID and Correct Password, it goes to the Main Menu
- However, if I enter a correct UserID and leave the Password blank, it goes to the Main menu.  Will post the VBA code shortly

Any insite would be grateful.
Anthony deGroot OP  @Reply  
      
7 months ago

Donald Blackwell  @Reply  
        
7 months ago
Anthony

Check the code for the PW check. I believe it should be:
PW = Nz(DLookup("Password", "Tbl_User", "UserID=" & ID), "")

You have an ampersand (&) instead of a comma.

Don
Anthony deGroot OP  @Reply  
      
7 months ago
Hi Don,  
I don't know how I missed that. Thanks.  So, I made the correction, and it still does the same thing.
When I enter a correct Username, and leave the Password blank, it will go to the Main menu.
Richard Rost  @Reply  
          
7 months ago
You can easily check for that at the top of the sub.

if IsNull(UserName) or UserName="" then...

Same with Password.
Donald Blackwell  @Reply  
        
7 months ago
Anthony

So I created a similar form just to try to walk through it like yours. And, YES, I ran into the same exact problem no matter what I tried to do.

One issue however, "Password" is a reserved word in Access and should be avoided as a table field name or a control name.

However, even after I renamed the field to "PWord" and the same for control, the problem persisted. Everything I've looked up says this is known to happen with unbound forms.

That said... I set the "Default Value" of my newly renamed "PWord" control to "" --- an empty string and then it behaved as expected... The validation failed when the password didn't match and it worked if the user's password was blank
Anthony deGroot OP  @Reply  
      
7 months ago
I changed the Field to PWord and the Control to an Empty String, however is appears to be working the same as it did with the original code.  If I enter a valid username, and leave the PWord BLANK (even though the user does have a password), it bypasses the security and open the Main Menu.  

I tried a new approach to the code.  Instead of PW <> PWord, I went with PW = PWord with an Else statement.  As I'm still learning VBA, not sure if this is an acceptable way of doing it.  The only thing now it a User must have a password.
Anthony deGroot OP  @Reply  
      
7 months ago

Donald Blackwell  @Reply  
        
7 months ago
Sorry my work around didn't work for you but glad you found a solution that did.

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

Next Unseen

 
New Feature: Comment Live View
 
 

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 2026 by Computer Learning Zone, Amicron, and Richard Rost. All Rights Reserved. Current Time: 3/5/2026 6:53:32 PM. PLT: 1s