Results 1 to 24 of 24

Login multi users

Threaded View

  1. #3
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,258

    Re: Login multi users

    Hello AKRAMI,

    I have modified your "Database" page to include a new column labeled "Locked". There is a cell for each user. If it is TRUE then the user can not login until the "Locked" cell has been changed back to TRUE. The user will be locked out after 3 failed attempts.

    The Table on "Database" has three dynamic named ranges: Users, Passwords, and Locked. You can add or remove users from these lists and not have to modify the UserForm code. The attached workbook has all the changes made to it.

    UserForm Code
    Private Sub CommandButton1_Click()
    
        Dim n       As Integer
        Dim pwd     As String
        Dim Tries   As Integer
        
            Tries = CInt(Label1.Caption)
            n = ComboBox1.ListIndex
                    
            If n = -1 Then
                Exit Sub
            End If
                
            If Range("Locked").Cells(n + 1, 1) = True Then
                Label1.Caption = "3"
                TextBox1.Value = ""
                ComboBox1.Value = ""
                ComboBox1.SetFocus
                MsgBox "Your account has been locked. Please see the Administrator to have it unlocked.", vbOKOnly + vbCritical
                Exit Sub
            End If
                
                pwd = Range("Passwords").Cells(n + 1, 1)
                
                If TextBox1 = pwd Then
                    MsgBox "You are Logged In!"
                    Unload Me
                    Exit Sub
                End If
            
                Tries = Tries - 1
            
                If Tries > 0 Then
                    Label1.Caption = Tries
                    TextBox1.Value = ""
                    TextBox1.SetFocus
                Else
                    Range("Locked").Cells(n + 1, 1).Value = True
                    Label1.Caption = "3"
                    TextBox1.Value = ""
                    ComboBox1.Value = ""
                    ComboBox1.SetFocus
                End If
            
    End Sub
    
    Private Sub UserForm_Initialize()
    
            Label1.Caption = "3"
            
            ComboBox1.RowSource = Range("Users").Address
            
    End Sub
    Attached Files Attached Files
    Sincerely,
    Leith Ross

    Remember To Do the Following....

    1. Use code tags. Place [CODE] before the first line of code and [/CODE] after the last line of code.
    2. Thank those who have helped you by clicking the Star below the post.
    3. Please mark your post [SOLVED] if it has been answered satisfactorily.


    Old Scottish Proverb...
    Luathaid gu deanamh maille! (Rushing causes delays!)

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. [SOLVED] login & logout attendance sheet for multiple users
    By MdYas in forum Excel Programming / VBA / Macros
    Replies: 12
    Last Post: 10-01-2015, 07:32 AM
  2. Hi all, i need help, how to create Login sheet with multiple users
    By jagankumarrohini in forum Hello..Introduce yourself
    Replies: 1
    Last Post: 04-24-2014, 12:20 AM
  3. Replies: 0
    Last Post: 03-18-2013, 02:58 PM
  4. Login/Password Prompt for Multiple Users
    By SARC777 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 08-13-2010, 08:15 AM
  5. Login/Password Prompt for Multiple Users
    By manny_cb in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 08-13-2010, 08:09 AM
  6. Users login to edit?
    By illusive817 in forum Excel - New Users/Basics
    Replies: 4
    Last Post: 05-22-2008, 07:09 AM
  7. Replies: 2
    Last Post: 10-04-2006, 05:49 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1