What am I doing wrong?

stevekos07

Registered User.
Local time
Today, 08:15
Joined
Jul 26, 2015
Messages
174
I can't seem to get this right! I have a login form frmLogin, with a textbox txtUserName. In the AfterUpdate event of the textbox I have a couple of lines of code. Firstly to open a hidden form with a single textbox that I want to retain the User Name from the Login form, and the second to create a temp variable "test" that will store in the hidden form.

Private Sub txtUserName_AfterUpdate()
DoCmd.OpenForm "frmUserLoginHidden", acNormal, , , , acHidden
TempVars.Add "test", Me.txtUserName.value
End Sub

I seem to have trouble calling the variable as the default in the hidden form when it loads.

I am new to temp variables (which is probably obvious!)

Can someone help?
 
If this is a domain-based login, use the user's domain name based on the Environ("Username") function.

If you put some parts of your login validation code in a general module, you can put the user's name in a public string variable in the declaration area of the general module. It should persist for the lifetime of the session unless you take an untrapped error that forces you to reset the project.
 

Users who are viewing this thread

Back
Top Bottom