Autofill certain fields on forms based on user

  • Thread starter Thread starter Tim Leach
  • Start date Start date
T

Tim Leach

I have been developing a table for use in my department which keeps track
of our contacts with the public. What I would like to do is ask for a user
name when it opens and have some default information entered into any forms
used in that session based on the user........Is this even possible? Thanks
to anyone who can help.
Tim
 
Tim,

It's definitely possible, and as long as users are working on a Windows
network it does not even require them to type in a user name. Function
Environ("UserName")
returns the network login in VB code, macros, expressions etc., so you can
use it to "identify" the user, and use a DLookup function to retrieve
whatever values form a table.
For instance, you could make a table called, say, tblUserValues, with fields
UsrID, Val1, Val2, ... etc, and then in your form design, use the default
value property of a textbox to retrieve that value by means of an expression
like:
=DLookup("[Val1]","tblUserValues","[UsrID] = ' " & Environ("UserName") & " '
")

HTH,
Nikos
 
Tim,

It's definitely possible, and as long as users are working on a Windows
network it does not even require them to type in a user name. Function
Environ("UserName")
returns the network login in VB code, macros, expressions etc., so you can
use it to "identify" the user, and use a DLookup function to retrieve
whatever values form a table.
For instance, you could make a table called, say, tblUserValues, with fields
UsrID, Val1, Val2, ... etc, and then in your form design, use the default
value property of a textbox to retrieve that value by means of an expression
like:
=DLookup("[Val1]","tblUserValues","[UsrID] = ' " & Environ("UserName") & " '
")

HTH,
Nikos


Tim Leach said:
I have been developing a table for use in my department which keeps track
of our contacts with the public. What I would like to do is ask for a user
name when it opens and have some default information entered into any forms
used in that session based on the user........Is this even possible? Thanks
to anyone who can help.
Tim

Thanks Nikos, I will give it a shot and let you know>>>>>>..
 
Back
Top