+ Reply to Thread
Results 1 to 3 of 3

Username/Password Login userform code

Hybrid View

  1. #1
    Forum Contributor
    Join Date
    09-16-2013
    Location
    Los Angeles, USA
    MS-Off Ver
    Excel 2011
    Posts
    620

    Username/Password Login userform code

    I am trying to work with the following code I found online for a login Username/Password Userform. When I correctly enter the username and password I get Run Time Error '448': Named argument not found. I have also attached a sample workbook.

    Private Sub CommandButton3_Click()
        Dim RowNo As Long
        Dim Id As String, pw As String
        Dim ws As Worksheet
        Dim aCell As Range
    
        On Error GoTo ErrorHandler
    
        If Len(Trim(Me.Username.Value)) = 0 Then
            Me.Username.Value.SetFocus
            MsgBox "Username cannot be empty"
            Exit Sub
        End If
    
        If Len(Trim(Password)) = 0 Then
            Password.SetFocus
            MsgBox "Password cannot be empty"
            Exit Sub
        End If
    
        Application.ScreenUpdating = False
    
        Set ws = Worksheets("User")
        Id = LCase(Me.Username.Value)
    
        Set aCell = ws.Columns(1).Find(What:=Id, LookIn:=xlValues, _
        LookAt:=xlWhole, SearchOrder:=xlByRows, SearchDirection:=xlNext, _
        MatchCase:=False, SearchFormat:=False)
    
        '~~> If match found
        If Not aCell Is Nothing Then
            RowNo = aCell.Row
            If Me.Password = aCell.Offset(, 1) Then
                AddRows.Show
                Unload Me
            Else
                MsgBox "Unable to match UserID or PasswordID, Please try again", vbOKOnly
            End If
        Else '<~~ If not found
            MsgBox "Unable to match UserID or PasswordID, Please try again", vbOKOnly
        End If
    CleanExit:
        Set ws = Nothing
        Application.ScreenUpdating = True
        Exit Sub
    ErrorHandler:
        MsgBox Err.Description
        Resume CleanExit
    End Sub
    Thank you for you help,
    James
    Attached Files Attached Files

  2. #2
    Valued Forum Contributor bulina2k's Avatar
    Join Date
    11-20-2012
    Location
    Urziceni, Ialomita, Romania
    MS-Off Ver
    2019 and 365
    Posts
    867

    Re: Username/Password Login userform code

    you're missing the 'AddRows' form.
    .. and don't forget to have fun!
    Bogdan.

    mark SOLVED and Add Reputation if my answer pleases you

  3. #3
    Forum Contributor
    Join Date
    09-16-2013
    Location
    Los Angeles, USA
    MS-Off Ver
    Excel 2011
    Posts
    620

    Re: Username/Password Login userform code

    I removed most of the sheets and userforms, I didn't think they would be important. Here is a full version of the workbook.
    Attached Files Attached Files

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. How to create a password login through a userform
    By xia0jj in forum Excel Programming / VBA / Macros
    Replies: 19
    Last Post: 01-10-2014, 05:59 AM
  2. username and password login
    By dc123 in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 12-17-2013, 08:38 AM
  3. Macro Running Userform for Username/Password
    By Escobarjr in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 01-03-2013, 12:08 PM
  4. Username and Password login in MS Excel 2010
    By beseda2004 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 11-03-2011, 03:45 PM
  5. [SOLVED] UserName login code
    By Bruise in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 03-10-2006, 12:10 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