Free Lessons
Courses
Seminars
TechHelp
Fast Tips
Templates
Topic Index
Forum
ABCD
 
Home   Courses   TechHelp   Forums   Help   Contact   Merch   Join   Order   Logon  
 
Back to Access Forum    Comments List
Upload Images   @Reply   Bookmark    Link   Email   Next Unseen 
Security Password Solution
Robert Lilly 
   
16 years ago
Thank you Richard and Micah for your offer to help me, but neither suggestion resolved my problem.
When I launch the program the ”LoginF”  image will be displayed. The Username is ”Bob” and then the Password is “123”. Clicking the ”Login”  will display the Main Menu. From this point on the program will function properly.
The problem lies in the fact that if you place a single character in either the Username or the Password boxes  and then click on the Login Button the message box will display “Invalid login”. Clicking on the message box will cause the Login Form to close. At this point you will have complete access to the database. This is the Problem.
Now when I change to the Design View  and select  the Login Button, then the Build Event option, the VBA Code will be displayed. If I do nothing at this point and close the program the system will lock up, no matter what you do, you'll hear a the beeping tone. At this point the only way to close the program is by using the “Control Alt Delete” buttons, and selecting  the  “End Task” At this point if I have not made any changes to “LoginF” I can restart the program and make changes as needed.
I have tried to make changes such as DoCmd.Quit, N = NZ(DLOOKUP(same),0) and End etc. to the VBA  code with no luck. After making any changes and saving  the program If I change over to “Layout View” and then try to view the ”LoginF “ form I will see that the program is locked up. At this point I have no alternative but to close the form with “Control Alt Delete “. When I try to open the program again, it will not display the Login Form, and will go directly to the database. Clicking on anything will only give me the beeping tones. I have no alternative at this point, but to again do a “Control Alt Delete “ and then delete the program, and start over again, making a copy of the original database.
What I’m trying to do is to have a Message Box again display  the statement saying “Invalid login” “Please enter a proper Username or the Password”
Option Compare Database
Private Sub Command19_Click()

    DoCmd.Quit

    
End Sub


Private Sub Command16_Click()

    If IsNull(txtUsername) Then
        MsgBox "Invalid username"
        Exit Sub
    End If
    If IsNull(txtPassword) Then
        MsgBox "Invalid password"
        Exit Sub
    End If
    
    Dim X As Long
    X = Nz(DLookup("UserID", "UserT", "Username='" & txtUsername & "' And Password='" & txtPassword & "'"))
    
    
    If X > 0 Then
        ' We have a valid user
        DoCmd.OpenForm "MainMenuF"
        DoCmd.Close acForm, "LoginF"
    Else
        MsgBox "Invalid Logon"
    End If
    
      
  
    DoCmd.Close acForm, "LoginF"

        
End Sub


Private Sub txtPassword_BeforeUpdate(Cancel As Integer)

End Sub

If a fellow student would like help resolve this problem send me an Eail at "[email protected]" and I will send you a small copy of the database.
Thank you in advance.


Reply from Richard Rost:

Well, the easy solution is just DON'T close your LoginF on an invalid logon. Clear the fields and leave the LoginF open. If it's a modal, popup form then they won't be able to do anything. Give them two buttons: Login and Quit. If they can't login, they'll have to click on Quit to close the database.

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

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: 5/31/2026 9:14:18 PM. PLT: 0s