Results 1 to 5 of 5

Thread: Password Problem???

  1. #1
    Guest

    Post

    I have a textbox (txtaddname) in one form (Form1), and a command button as well. When the button is clicked it pulls up another Form. This is where I place the username and password. If both are correct, I want it to make the textbox in Form1 visible, because by default it is hidden. How do I get it to unhide the textbox?

  2. #2
    Guru Aaron Young's Avatar
    Join Date
    Jun 1999
    Location
    Red Wing, MN, USA
    Posts
    2,177

    Post

    Store the Result of the Password Check in the Password Forms Tag Property, then check that From your Calling Form, ie.
    Code:
    Private Sub Command1_Click()
        frmLoginForm.Show vbModal
        Text1.Visible = Len(frmLoginForm.Tag)
        Unload frmLoginForm
    End Sub
    In frmLoginForm...
    Code:
    Private Sub cmdCheckPassword_Click()
        If txtPassword = "Password" Then
            Tag = "OK"
        End If
        Unload Me
    End Sub
    
    Private Sub Form_QueryUnload(Cancel As Integer)
        If Visible Then
            Hide
            Cancel = True
        End If
    End Sub
    ------------------
    Aaron Young
    Analyst Programmer
    [email protected]
    [email protected]


  3. #3
    Guest

    Post

    I edited the code a bit...
    I took off the Form_Query unload section, it didn't like that procedure.
    It verifies the password, but only to go back to Form1. The textbox that I want to appear doesn't.

  4. #4
    Guru Aaron Young's Avatar
    Join Date
    Jun 1999
    Location
    Red Wing, MN, USA
    Posts
    2,177

    Post

    The Code in the QuearyUnload Event is crucial to the Code working, it hides the Form on the First Unload Call to return to the Calling Form, where it has the chance to extract the value from the Tag, try the Code I posted as is to see what I mean.

    ------------------
    Aaron Young
    Analyst Programmer
    [email protected]
    [email protected]


  5. #5
    Guest

    Post

    I tried it, and still no dice, which form should the Query be unloading, form1 (my main program) or form2 (where I enter the password?)
    Also do I need to input anything in the Passwordtxt Tag property, or when I enter the correct password does it do it automatically?

Posting Permissions

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



Click Here to Expand Forum to Full Width