• Password (97/2000)

    Author
    Topic
    #379422

    A simple problem that is taxing a simple mind. I have an unbound textbox and a command button on a form. The user types in the password into the textbox and clicks the button. In the on-click event procedure for the button I have put this code simply as a test. The problem is if the box is left empty and the button clicked, the word ‘Welcome’ appears when I wish it to read ‘Invalid’.

    Private Sub Command2_Click()
    Dim MyPass As String
    MyPass = “Anything”

    If Text0.Value MyPass Or Text0.Value = “” Then GoTo Line2 Else GoTo Line1

    Line1:

    Text0.Value = “Welcome”
    End

    Line2:
    Text0.Value = “Invalid”

    End Sub

    Help please!

    Rob

    Viewing 0 reply threads
    Author
    Replies
    • #631689

      Hey Rob,
      Maybe you could also add a check for NULL. I have had the same issue before.

      If Text0.Value MyPass Or Text0.Value = “” or isnull(text0) Then GoTo Line2 Else GoTo Line1

      Mark

      • #631690

        Thanks Mario for your rapid response. It works a treat.

        Rob

    Viewing 0 reply threads
    Reply To: Password (97/2000)

    You can use BBCodes to format your content.
    Your account can't use all available BBCodes, they will be stripped before saving.

    Your information: