Environ Username (1 Viewer)

jedder18

Just Livin the Dream!
Local time
Yesterday, 22:21
Joined
Mar 28, 2012
Messages
135
Using Win 7 and Access 2007

db will be split and on a server

If it's possible:
Would like to use the Environ username somewhere in the db so the user only sees their records.
Where would I place this? Or is their different code I should be using for this purpose???

:confused:
 

Mile-O

Back once again...
Local time
Today, 06:21
Joined
Dec 10, 2002
Messages
11,316
Or is their different code I should be using for this purpose?


You may be better to use the code at this link. I had some Environ() problems recently and, while not the same as your issue, would never used it again and will instead retain fOSUsername() on the link.

Would like to use the Environ username somewhere in the db so the user only sees their records.
Where would I place this?
In your query. (Assuming you have, somewhere in the table you a querying, the user name already recorded in a field.
 

jedder18

Just Livin the Dream!
Local time
Yesterday, 22:21
Joined
Mar 28, 2012
Messages
135
Thanks for the reply.
Very interesting. I found the code you link to on another thread and someone suggested the environ as an alternative, but, not where to use or how.
 

gemma-the-husky

Super Moderator
Staff member
Local time
Today, 06:21
Joined
Sep 12, 2006
Messages
15,660
it isn't so simple

the syntax is environ("username") and it returns the windows login name

however, it's one thing using this to determine whether a form can open or not - but to use it determine which records you see.

To limit the records requires you requires you either to have a query that returns records based on the username, or to filter the records displayed in forms/returns.

doing this across the board will probably be quite an extensive project.
 

Galaxiom

Super Moderator
Staff member
Local time
Today, 15:21
Joined
Jan 20, 2009
Messages
12,853
the syntax is environ("username") and it returns the windows login name

No it doesn't. It returns the username environment variable.

The key word here is "variable". Its default value is the Windows username but it is very easily changed to be any string.

Just type the following into a cmd window.

Code:
set username whatever
 

Users who are viewing this thread

Top Bottom