Password selection

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • nkp

    Password selection

    I wish to enable more than one named user to access password protected
    menu ie: Tom,Dick and Harry rather than JUST Tom.
    Can I do this with Case Select...doesn' t seem work for me.
    Assistance much appreciated.


    Private Sub cmdOk_Click()
    Dim blnEnter As Boolean
    Static intCount As Integer
    blnEnter = False
    intCount = intCount + 1
    lblAttempt.Capt ion = intCount

    Select Case txtUsername
    Case "Tom"

    If txtPassword = "nkp12345" Then
    blnEnter = True
    End If
    End Select

    If blnEnter = True Then
    Unload Me
    frmMenu.Show
    Else
    If intCount >= 3 Then
    MsgBox "you have exceeded your 3 attempts"
    Unload Me
    End If
    End If
    End Sub

  • Randy Birch

    #2
    Re: Password selection

    If the question is how to hard-code multiple names, just add additional Case
    statements:

    Select Case txtUsername.Tex t
    Case "Tom"

    If txtPassword.Tex t = "nkp12345" Then
    blnEnter = True
    End If

    Case "Dick"

    If txtPassword.Tex t = "abc99009" Then
    blnEnter = True
    End If

    Case "Harry"

    If txtPassword.Tex t = "qwe66766" Then
    blnEnter = True
    End If

    Case Else:
    End Select


    If you're asking how to avoid hard coding the usernames and passwords so any
    Tom, Dick or Harry can use the system, you'll have to resort to saving the
    valid usernames and passwords in a text file or the registry, and based on
    the username entered, load the pw to check and go from there.

    --

    Randy Birch
    MVP Visual Basic

    Please respond only to the newsgroups so all can benefit.


    "nkp" <weatheredwall@ btinternet.com> wrote in message
    news:boh6n1$rv9 [email protected] ernet.com...
    : I wish to enable more than one named user to access password protected
    : menu ie: Tom,Dick and Harry rather than JUST Tom.
    : Can I do this with Case Select...doesn' t seem work for me.
    : Assistance much appreciated.
    :
    :
    : Private Sub cmdOk_Click()
    : Dim blnEnter As Boolean
    : Static intCount As Integer
    : blnEnter = False
    : intCount = intCount + 1
    : lblAttempt.Capt ion = intCount
    :
    : Select Case txtUsername
    : Case "Tom"
    :
    : If txtPassword = "nkp12345" Then
    : blnEnter = True
    : End If
    : End Select
    :
    : If blnEnter = True Then
    : Unload Me
    : frmMenu.Show
    : Else
    : If intCount >= 3 Then
    : MsgBox "you have exceeded your 3 attempts"
    : Unload Me
    : End If
    : End If
    : End Sub
    :


    Comment

    • nkp

      #3
      Re: Password selection

      Thanks Randy...

      Randy Birch wrote:[color=blue]
      > If the question is how to hard-code multiple names, just add additional Case
      > statements:
      >
      > Select Case txtUsername.Tex t
      > Case "Tom"
      >
      > If txtPassword.Tex t = "nkp12345" Then
      > blnEnter = True
      > End If
      >
      > Case "Dick"
      >
      > If txtPassword.Tex t = "abc99009" Then
      > blnEnter = True
      > End If
      >
      > Case "Harry"
      >
      > If txtPassword.Tex t = "qwe66766" Then
      > blnEnter = True
      > End If
      >
      > Case Else:
      > End Select
      >
      >
      > If you're asking how to avoid hard coding the usernames and passwords so any
      > Tom, Dick or Harry can use the system, you'll have to resort to saving the
      > valid usernames and passwords in a text file or the registry, and based on
      > the username entered, load the pw to check and go from there.
      >[/color]

      Comment

      Working...