Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

how to make a "login screen" force the users name

Status
Not open for further replies.

tarena

IS-IT--Management
Nov 28, 2005
70
0
0
US
I am using Access 97.

I have a database that has a login screen for users to access the forms within it. When a user logs in, I want the name they logged in under to force that name onto any form they use. Is there a way to do this?

Thanks Tarena
 
There is lots of different ways. One way is to save this to a public variable in a standard module, and build a function that returns the variable. You can use the function in a calculated control of a form

public strUserName as string

public function getUserName() as string
getUserName = strUserName
end function

in a control of a form:
getUserName()
 
You can store the current login name as a variable and on load of the forms populate the name onto the form?

Hope this helps

HarleyQuinn
---------------------------------
Get the most out of Tek-Tips, read FAQ222-2244 before posting.
 
Oops! A bit slow there... [smile]

HarleyQuinn
---------------------------------
Get the most out of Tek-Tips, read FAQ222-2244 before posting.
 
may also look into pulling the name from the environmental table
Environ("username")
 
ok. I'm not really that advanced. I created the module but the log in information is not being saved anywhere. Is this going to be a problem?
 
You will need at least a very basic understanding of VBA programming.

 
It will be if you want to persist it through forms.

You can declare a variable in that module you created and set it to the entered username on a successful login. You can then use that variable through out your code to populate the form details you want.

Hope this helps

HarleyQuinn
---------------------------------
Get the most out of Tek-Tips, read FAQ222-2244 before posting.
 
Do you have a button on your login form that the user selects after entering his/her name and password? Just store the user name from there into the public variable suggested by MajP.
Code:
strUserName = me!yourTextBoxName


Randy
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top