Global Variable Question

  • Thread starter Thread starter Joe Williams
  • Start date Start date
J

Joe Williams

I am trying to set up a quick and dirty user login without having to go the
route of Access built in user security. This login would only be for gaining
access to the program, not anything deeper than that.

What is the proper way to declare a global variable for UserID? The user
would login with a form that would match thier username against the known
password, and if successfully logged in, the username would be assigned to
the Global Variable for that front End that I could reference when needed.

Where and how wold I declare this so that all forms, procedures, etc would
recognize the UserID global variable when needed?

Thanks

Joe
 
Joe Williams said:
I am trying to set up a quick and dirty user login without having to go the
route of Access built in user security. This login would only be for gaining
access to the program, not anything deeper than that.

What is the proper way to declare a global variable for UserID? The user would
login with a form that would match thier username against the known password,
and if successfully logged in, the username would be assigned to the Global
Variable for that front End that I could reference when needed.

Where and how wold I declare this so that all forms, procedures, etc would
recognize the UserID global variable when needed?

Just put...

Public UserID As String

....in any standard module.
 
Just put...

Public UserID As String

...in any standard module.


Be aware that you can only reference this directly from VBA code - you
can't use it (for example) in a calculated Control unlese you first
declare a Function which returns it.

Please respond to the Newsgroup, so that others may benefit from the exchange.
Peter R. Fletcher
 
Back
Top