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 > String Functions < Print Documents | AutoText >
Back to String Functions    Comments List
Upload Images   Link   Email  
Password Checks
Kevin Robertson 
          
6 months ago
I just built the Form below to change a users temporary password (generated with a button click by an Admin). It uses images to determine if the criteria has been met or not.

I used the On Change event for this.
It should be noted that you need to reference the Text property otherwise you will get an 'Invalid use of null' error.

    If IsFound(NewPassword.Text, AllCaps) Then
Kevin Robertson OP 
          
6 months ago

Kevin Robertson OP 
          
6 months ago

Sami Shamma 
             
6 months ago
very professional looking. I like. I Like.
Alex Hedley 
            
6 months ago
Now you just need a strength meter :p
Going from red to green 🔴🟠🟡🟢
Kevin Robertson OP 
          
6 months ago
Yeah. That would be neat. No idea how to do it but that would be neat.
I'm guessing some overlapping Text Boxes or Rectangles would do it and simply control the visibility in code.
Matt Hall 
         
6 months ago
I made a radial gauge using a series of lines.  I named them consecutively Line0 to Line100, Set the border width wide enough to overlap, and toggled visibility with a for/next loop.  The needle (Line) position and slope are controlled in VBA using a touch of trig.  You could do something similar with a bar.

The form looks sharp.
Alex Hedley 
            
6 months ago
Could you use the techniques in Progress Bar or was something similar covered in a Dev lesson?
Kevin Robertson OP 
          
6 months ago
Yeah. I was thinking something similar.
The full Progress Bar lessons were in Access Developer 18
Kevin Robertson OP 
          
6 months ago
I added a basic strength indicator to my Form. Looks pretty cool and works well.
Kevin Robertson OP 
          
6 months ago

Kevin Robertson OP 
          
6 months ago

Kevin Robertson OP 
          
6 months ago
This is a snippet from my load event.
I do have other code that sets some other values but this is related to the password strength.

DetailsPrivate Sub Form_Load()

    Dim Ctrl As Control, EmptyWidth As Long
    
    EmptyWidth = PasswordStrengthEmpty.Width

    For Each Ctrl In Me.Controls
        If Ctrl.ControlType = acRectangle Then
            If Left(Ctrl.Name, 16) = "PasswordStrength" Then
                Ctrl.Left = PasswordStrengthEmpty.Left
                Ctrl.Top = PasswordStrengthEmpty.Top
                If Ctrl.Name <> "PasswordStrengthEmpty" Then Ctrl.Visible = False
            End If
        End If
    Next
    
    PasswordStrengthVeryWeak.Width = EmptyWidth / 4
    PasswordStrengthWeak.Width = EmptyWidth / 2
    PasswordStrengthStrong.Width = (EmptyWidth / 2) + (EmptyWidth / 4)
    PasswordStrengthVeryStrong.Width = EmptyWidth

End Sub
Alex Hedley 
            
6 months ago
Love it!
Matt Hall 
         
6 months ago
Very nice.
Kevin Robertson OP 
          
6 months ago
I decided to disable the Save button unless all the conditions for my password are met.
This has reduced the amount of code needed for my checks by about a third.

DetailsOption Compare Binary
Option Explicit

Private Const NARROW_WIDTH As Long = 7680
Private Const WIDE_WIDTH As Long = 12600

Dim IsValidated As Boolean

Private Sub ValidatePassword()

    IsValidated = True
    
    If imgPasswordUpper.Picture = ImageFolder & PASSWORD_INVALID Then IsValidated = False
    If imgPasswordLower.Picture = ImageFolder & PASSWORD_INVALID Then IsValidated = False
    If imgPasswordNumber.Picture = ImageFolder & PASSWORD_INVALID Then IsValidated = False
    If imgPasswordSpecial.Picture = ImageFolder & PASSWORD_INVALID Then IsValidated = False
    If imgPasswordMinimum.Picture = ImageFolder & PASSWORD_INVALID Then IsValidated = False
    If imgPasswordMaximum.Picture = ImageFolder & PASSWORD_INVALID Then IsValidated = False
    If imgPasswordMatch.Picture = ImageFolder & PASSWORD_INVALID Then IsValidated = False

    If Not IsValidated Then
        btnSaveCredentials.Enabled = False
    Else
        btnSaveCredentials.Enabled = True
    End If
    
End Sub


I called this sub in the Change events for both NewPassword and ConfirmNewPassword.
Also now checking for duplicate Usernames.
Kevin Robertson OP 
          
5 months ago
My temporary password is now generated to include Upper Case, Lower Case, Numbers and Special Characters. It will also always be 16 characters in length.

DetailsPrivate Function GeneratePassword(Style As Integer) As String

    Dim Rand As Integer, FoundRand As Boolean
    
    Randomize
    If Style = 1 Then Rand = Int(Rnd * 25) + 65
    If Style = 2 Then Rand = Int(Rnd * 25) + 97
    If Style = 3 Then Rand = Int(Rnd * 9) + 48
    
    If Style = 4 Then
        FoundRand = False
        While Not FoundRand
            Rand = Int(Rnd * 104) + 33
            If Rand = 33 Or Rand = 35 Or Rand = 36 Or Rand = 37 Or _
                Rand = 43 Or Rand = 45 Or Rand = 64 Or Rand = 137 Then
                FoundRand = True
            End If
        Wend
    End If

    GeneratePassword = Chr(Rand)
    
End Function


The function is called as part of my button click event which also sends an email detailing the temporary credentials.
This is how the function is called in by button.

Details    Password = ""
    While Len(Password) < 16
        Randomize
        Rand = Int(Rnd * 4) + 1
        Password = Password & GeneratePassword(Rand)
    Wend
Kevin Yip 
     
5 months ago
To measure password "strength," this page may offer some clues:

     https://www.grc.com/haystack.htm

Type a password in the box, and you will see the estimated amount of time it would take for hackers to hack it.  A weak password would only take seconds to crack, while a strong one would take trillions of years.

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

 
 
 

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: 4/24/2025 12:49:04 AM. PLT: 1s