I read somewhere in this forum about an =GetUser function and I can't remember where. Could someone please direct me to some advice on this function and possibly some examples on any VBA coding?
I read somewhere in this forum about an =GetUser function and I can't remember where. Could someone please direct me to some advice on this function and possibly some examples on any VBA coding?
what user do you want to get? the windows user name? if that's what you're looking for, one way to get it is here: http://www.ajenterprisesonline.com/_...?fname=GetUser
a simpler way of doing it is to use the environ() function. either of these should be fine:Code:=environ(39) =environ("username")
Thanks, could you briefly explain the environ function to me? And where shold the code go? I want to be able to track who did what to what file kind of thing.
who did what to what file? what do you mean? maybe a timestamp is what you need.
the environ() function I don't know much about, in depth, but in general it can return some useful information about the local computer's current environment. Hence, the function name.
There are 42 environment variables, some useful and some not. If you want to find out what they do, write a loop in vba code and print them out to the immediate window. The results I think will all list equalities. Left side = variable...right side = value
The indexes are 1-42
Im mostly just curious about the function.
What i remember reading in the forum was someone who wanted to keep track of what user deleted a file. Kind of like a big brother function and I could see how that would come in handy around here as everyone has a work alternate that is at work when they are not, and the finger pointing is easy because the other person wouldn't be here to deny it.
If there was a way to run a report showing who was the last to manipulate data on a specific record and they knew it was possible for the admin to run a report I might be able to put a stop to the old blame game.
this is exactly why people use timestamps. use a form's DIRTY event and a table log and you can solve this in a tick!
Would you mind showing me an example or point me in the direction of where some literature examples might be?
Like I said still learning about Access and code, just started learning earlier this year.
Examples really help me in the learning process.
google "ms access audit trail"
that'll bring up allen browne's article on it, and it also brings up a KB article from ms about it...which I didn't know even existed.
Sweet! Thanks again, I will mark this thread as solved since I was just seeking info. If I decide to implement this function in my DB and have any other questions or issues I will create another post.
The getuser function I posted in the code repository:
https://www.accessforums.net/code-re...thod-7675.html
This will return the user loginID securely (not hackable - ie. cannot be mimicked by a user) which can be done via other methods.