Login name - update field on subform

suemunds

New member
Local time
Today, 09:12
Joined
Dec 16, 2014
Messages
5
I have an access 2010 database with an initial form for user login. After selecting their login, users go to the main tabbed navigation form. On the first tab, I have form with a dashboard as a subform containing a field that says "Welcome" with the user's name (obtained from the login). My problem is, users have to click on the subform for the name field to update. For the life of me, I can't figure out how to have the name automatically populate when the login form closes.
 
Are you storing the UserName as a variable? If so create a Public function like this:
Code:
Public Function GetUserID() As String
    GetUserID = varUserName    'You will need to change this to your variable name
End Function

Then on your subform, make sure the box you want the Welcome to appear in is a textbox with the following as the control source:

="Welcome " & GetUserID()
 
Thanks for responding.

For the login form, I have a combo box where users select their name & ID number. The login name is captured as a temp var. The Welcome box (on a separate subform) is coded:

="Welcome, " & [TempVars]![LoginSNUM] & "!"

The issue I have, and maybe it is nit-picky, is that after the user closes the login form but before they click somewhere in the form containing the welcome box, the welcome box reads "Welcome, !". They have to click on the sub-form to get their name populated.
 

Users who are viewing this thread

Back
Top Bottom