Keep Username as a Variable

  • Thread starter Thread starter ABinBoston
  • Start date Start date
A

ABinBoston

I have a form that opens, asking for a username, which it validates against a
users table. If the username matches, clicking OK will close the login form and
open a main menu.

I would like to retain the username as a variable, and put it in a hiden field
on other forms to show that this user entered the record.

How do I declare the username as a variable? also, there will be several users
in the databse at any given time, so I need to declare each individual name for
each session.

Thanks - AB
 
Firstly, you must split the database so each user has their own copy of the
front end. If that is a new idea, see:
Split your MDB file into data and application
at:
http://members.iinet.net.au/~allenbrowne/ser-01.html

Instead of closing your login form, set its Visible property to No. You can
now refer to the text box on the form from anywhere in your application
with:
=[Forms].[NameOfYourLoginFormHere].[NameOfYourUserTextboxHere]

I think you will find that easier than assigning a public string variable to
the user name. During development, the value of the variable is lost
whenever you reset your project. As a bonus, you can use the Close event of
the hidden form to know that the database is closing.
 
Back
Top