Autofill certain fields on forms based on user

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
 
N

Nikos Yannacopoulos

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
 
T

Tim Leach

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>>>>>>..
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top