Re: Capture Pswrd & Userid To Auto Populate Form



"Nikki Norris" wrote in message:
news:d8a425fa5c104c88ad01e2eeb45b716e@xxxxxxxxxxxxxxxxxxxx

> Hi, the user audience does not have access knowledge. The security is just
> to audit the last person that modified the records. My form will auto
> populate the username field with the locked property set to "yes" so no one
> can change it once in the form. A simple routine is all I need to satisfy
> this requirement.

Nikki,

1. Just create a new public variable in a standard module:

Public gstrUserID As String

2. Create a new public function in that same module:

Public Function GetUserID()
GetUserID = gstrUserID
End Function

3. After your "authentication" code runs on your login form, pass the
user name to this public variable. Something like so:

gstrUserID = Me.txtUserName

4. Then on any text box you can set a default value of:

GetUserID()

When that other form opens the text box will default to display the name
of the currently logged on user. You can just set the Enabled property
to False so it cannot be messed with.

You'll need to be careful about this public variable being reset if an error
in your code occurs. To avoid this, distribute MDE files to your users
(you should be doing this anyway) so the variable will not be reset if an
error occurs.

I *must* remind you again that this is far from being "secure" at all. This
setup can easily be bypassed with little trouble. For the best security
possible in an Access/Jet database you really should consider implementing
User Level Security:

http://www.ltcomputerdesigns.com/JCReferences.html#Security

--
Jeff Conrad
Access Junkie
Bend, Oregon


.



Relevant Pages