Reset when reopened (1 Viewer)

johannaellamay

Registered User.
Local time
Tomorrow, 02:03
Joined
Jul 19, 2014
Messages
190
Hi! I have a Main form and a Login form. When the user opens the database, the Login form opens. Text boxes for username and password are unbound and connected to a table that stores authorized usernames and passwords. When the username and password are correct, the Login form is set to Visible = False. Then the Main form opens. The Main form has a "hyperlinked" textbox with the following expression:
Code:
=[Forms]![f_Login]![txtUserName]
which shows the username entered in the Login form. When the user clicks the textbox, the Main form's visibility is set to False and the Login form's visibility is set to True. But it's still showing the data entered initially upon login.

What I want is that when Login form is reopened, the textboxes for username and password should be cleared. How do I do that?
 

burrina

Registered User.
Local time
Today, 13:03
Joined
May 10, 2014
Messages
972
When you say unbound, do you mean the form does not have a record source?
Normally the data is verified via code and checked against a table.

Since the form is unbound, when the db is opened again, their will no values in your textboxes.
?
 

johannaellamay

Registered User.
Local time
Tomorrow, 02:03
Joined
Jul 19, 2014
Messages
190
When you say unbound, do you mean the form does not have a record source?
Normally the data is verified via code and checked against a table.

Since the form is unbound, when the db is opened again, their will no values in your textboxes.
?

Hi! Yes, you're right. But Login form is not closed. The visibility is just set to False. So it's still basically running in the background, therefore, the data is not cleared. If I decide to Close the form instead of False Visibility, the value of the username will not show on the Main table. I need it for the hyperlinked textbox if that makes sense. :)

Thanks for the reply btw.
 

burrina

Registered User.
Local time
Today, 13:03
Joined
May 10, 2014
Messages
972
Why would you close it if you need that data? When the same user is logged in?
 

johannaellamay

Registered User.
Local time
Tomorrow, 02:03
Joined
Jul 19, 2014
Messages
190
Why would you close it if you need that data? When the same user is logged in?

Hi! No, I don't want to close the form. I just stated that hypothetically. When the same user is logged, I still don't want the data to show for security purposes. But that's besides the point.

I just need to find a way to clear the unbound textboxes when I reset the Visibility to True again (upon clicking the hyperlinked textbox on the Main form).
 

burrina

Registered User.
Local time
Today, 13:03
Joined
May 10, 2014
Messages
972
Forms!frmLogIn.Visible = True
Me.SomeTextbox =""
Of course be sure and set to your form name and textbox.

HTH
 

johannaellamay

Registered User.
Local time
Tomorrow, 02:03
Joined
Jul 19, 2014
Messages
190
Forms!frmLogIn.Visible = True
Me.SomeTextbox =""
Of course be sure and set to your form name and textbox.

HTH

Hi! Thanks! It works now. This is the final code on my Main table:

Code:
Private Sub txtCurrentUser_Click()
    DoCmd.Close acForm, "f_Main"
    Forms!f_Login.Visible = True
        Forms!f_Login!txtUserName = ""
        Forms!f_Login!txtPassword = ""
End Sub
 

Users who are viewing this thread

Top Bottom