-
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?
-
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]
-
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.
-
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]
-
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?