Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Retreive Windows User ID when record is updated

Posted on 2016-09-16
6
Medium Priority
?
56 Views
Last Modified: 2016-10-30
I have a database and want to store the username that made the update in Access 2010.  How do I do this?  I was looking online and all the solutions appear to be overengineered.  Can someone help with this?
0
Comment
Question by:mtrussell
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
6 Comments
 
LVL 48

Accepted Solution

by:
Dale Fye earned 1000 total points
ID: 41801735
I use the code found here: http://www.access.mvps.org/access/api/api0008.htm

and then set the default value of the field in the database to:

=fosusername()
0
 
LVL 39

Assisted Solution

by:PatHartman
PatHartman earned 1000 total points
ID: 41801819
I use the Environ("username") for the apps where I don't require a login.  You can also get the computer name that way if you want it - Environ("computername")


In the BeforeUpdate event of every form that updates a table that includes the ChangeBy column -

Me.ChangeBy = Environ("username")

I don't know if this produces different results from what Dale posted but the fousername() as written only works for 32-bit office installations.  You would need to fix it to use it in a 64-bit environment.
0
 
LVL 48

Expert Comment

by:Dale Fye
ID: 41802132
No, Pat, you don't need to fix it for a 64-bit environment, you need to fix it for 64 bit Office, it works fine in 32 bit versions of Office.

Difference is you cannot spoof fosusername, but you can (if you know what you are doing) change the Environ("UserName") value.
0
 [eBook] Windows Nano Server

Download this FREE eBook and learn all you need to get started with Windows Nano Server, including deployment options, remote management
and troubleshooting tips and tricks

 
LVL 39

Expert Comment

by:PatHartman
ID: 41802151
That's what I said in the preceding sentence.  Reading the two sentences together the statement should be clear.

So they return the same thing except that you can modify the value stored by Environ() if you are technically savvy.
0
 

Author Comment

by:mtrussell
ID: 41806445
Thanks guys.  It worked.
0
 
LVL 27

Expert Comment

by:MacroShadow
ID: 41865717
No comment has been added to this question in more than 21 days, so it is now classified as abandoned.

I have recommended this question be closed as follows:

Split:
-- Dale Fye (Access MVP) (https:#a41801735)
-- PatHartman (https:#a41801819)


If you feel this question should be closed differently, post an objection and the moderators will review all objections and close it as they feel fit. If no one objects, this question will be closed automatically the way described above.

MacroShadow
Experts-Exchange Cleanup Volunteer
0

Featured Post

Learn Veeam advantages over legacy backup

Every day, more and more legacy backup customers switch to Veeam. Technologies designed for the client-server era cannot restore any IT service running in the hybrid cloud within seconds. Learn top Veeam advantages over legacy backup and get Veeam for the price of your renewal

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The Windows Phone Theme Colours is a tight, powerful, and well balanced palette. This tiny Access application makes it a snap to select and pick a value. And it doubles as an intro to implementing WithEvents, one of Access' hidden gems.
Code that checks the QuickBooks schema table for non-updateable fields and then disables those controls on a form so users don't try to update them.
The view will learn how to download and install SIMTOOLS and FORMLIST into Excel, how to use SIMTOOLS to generate a Monte Carlo simulation of 30 sales calls, and how to calculate the conditional probability based on the results of the Monte Carlo …
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…

609 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question