set the username to a form upon login

kevin19

Registered User.
Local time
Today, 03:33
Joined
Jan 28, 2013
Messages
81
Upon logging in, I need to set the username to a textbox in a form and store the field.
I have a form named Task and it has a field named Username. This Username is the Masterfield in this form which has a subform. The main form and the subform are linked by the UserID.
I am having a big headache as I cannot set the username from the login form to this Task form.
Say, I log in as Jim and when I open the Task form, i want to see Jim appears as the username and all the records relating to him.
If another user logs in,say, Mary then her name should appear as the Username and all the records pertaining to her should appear.
Help Please!!
 
I would base the task form on a query that used the login form in the user criteria.
 
Thanks! But what do you specifically mean?
My username in the login form is unbound combo box but my username in the Task form is bound to the username. In this case the userID.
Can I just do a query that joins the login table with the tasks table? Is that what you mean? and just pull the info from there?
Thanks for your help!
 
No, I meant what I said. Create a query on the tasks table that has a criteria on the user name field that points to the login form. It will look like:

Forms!FormName.TextboxName

As long as the login form remains open (it can be hidden), all other forms and reports in the database can use the user name from there to restrict themselves.
 
Thanks for your prompt reply! Very much appreciated!
My text box returns the Id number as this is the user id. I want to display the name. How? I am sorry I am not that great as I am on a learning curve with access.
My combo box displays the name in the login box but the user id is bound. So when I did what you taught me only the id comes up.
Thanks!
 
Also, you mentioned that the login form should be hidden. What is the code to hide it? I am using access 2007 and I think the command hide is unavailable at present. How do I unhide it when I quit the application?
 

Users who are viewing this thread

Back
Top Bottom