Solved

Retreive Windows User ID when record is updated

Posted on 2016-09-16
6
45 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 47

Accepted Solution

by:
Dale Fye (Access MVP) earned 250 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 36

Assisted Solution

by:PatHartman
PatHartman earned 250 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 47

Expert Comment

by:Dale Fye (Access MVP)
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
Migrating Your Company's PCs

To keep pace with competitors, businesses must keep employees productive, and that means providing them with the latest technology. This document provides the tips and tricks you need to help you migrate an outdated PC fleet to new desktops, laptops, and tablets.

 
LVL 36

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

Salesforce Made Easy to Use

On-screen guidance at the moment of need enables you & your employees to focus on the core, you can now boost your adoption rates swiftly and simply with one easy tool.

Question has a verified solution.

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

It’s been over a month into 2017, and there is already a sophisticated Gmail phishing email making it rounds. New techniques and tactics, have given hackers a way to authentically impersonate your contacts.How it Works The attack works by targeti…
This article describes two methods for creating a combo box that can be used to add new items to the row source -- one for simple lookup tables, and one for a more complex row source where the new item needs data for several fields.
Using Microsoft Access, learn some simple rules for how to construct tables in a relational database. Split up all multi-value fields into single values: Split up fields that belong to other things into separate tables: Make sure that all record…
With Microsoft Access, learn how to start a database in different ways and produce different start-up actions allowing you to use a single database to perform multiple tasks. Specify a start-up form through options: Specify an Autoexec macro: Us…

726 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