Thanks Thanks:  0
Likes Likes:  0
Results 1 to 3 of 3

Thread: help please!!

  1. #1
    New Member
    Join Date
    Mar 2002
    Posts
    26
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    I have a project which requires a password to allow specific users to log on. I have tryed using this:

    Private Sub CommandButton1_Click()
    Dim strPass As String

    strPass = TextBox1.Text

    Do Until iTries = 3
    If strPass = "Secret" Then
    MsgBox "Log in OK!"
    Run "LogInOk"
    End
    End If
    MsgBox "Log in NOT OK!"
    iTries = iTries + 1
    Exit Do
    Loop

    If iTries = 3 Then Unload Me

    End Sub

    However when I press the macro command button nothing happens, I have no Idea what is going on. Any help will be appreciated.
    Thanks alot
    Craig

  2. #2
    Rest in Peace
    Join Date
    Feb 2002
    Posts
    1,582
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    Hi Craig, This code looks very familiar )

    Try this

    Dim strPass As String
    Dim iTries As Integer
    Private Sub CommandButton1_Click()


    strPass = TextBox1.Text

    Do Until iTries = 3
    If strPass = "Secret" Then
    MsgBox "Log in OK!"
    Run "LogInOk"
    End
    End If
    MsgBox "Log in NOT OK!"
    iTries = iTries + 1
    Exit Do
    Loop

    If iTries = 3 Then Unload Me

    End Sub


    The bit I modified was your variable iTries It MUST be at the Module level else it will loose it's value each time.

  3. #3
    New Member
    Join Date
    Mar 2002
    Posts
    26
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default


    lol, yeah it does look familiar, thanks for that by the way. I'll see how this works now then, thanks alot

    Craig

Some videos you may like

User Tag List

Like this thread? Share it with others

Like this thread? Share it with others

Posting Permissions

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