Results 1 to 3 of 3
  1. #1
    4 Star Lounger
    Join Date
    Sep 2002
    Location
    Stafford, Staffordshire, England
    Posts
    585
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Password (97/2000)

    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
    <font color=blue><font face="Script MT Bold"><big>Rob</big></font face=script></font color=blue>

  2. #2
    4 Star Lounger
    Join Date
    Jun 2001
    Location
    Indianapolis, Indiana, USA
    Posts
    527
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Password (97/2000)

    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

  3. #3
    4 Star Lounger
    Join Date
    Sep 2002
    Location
    Stafford, Staffordshire, England
    Posts
    585
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Password (97/2000)

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

    Rob
    <font color=blue><font face="Script MT Bold"><big>Rob</big></font face=script></font color=blue>

Posting Permissions

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