Trying to Pull User Name From Network

  • Thread starter Thread starter corydawson935
  • Start date Start date
C

corydawson935

Hello,
I am working on a database that my work uses. It has a FE/BE. I am an uber
novice when it comes to code...so what I am looking for is a way to place in
code so that when I click the Save/Exit button it will pull that persons
Alias from the network (being they have to log on using their alias to get on
the network) into the desired field. I just don't know the code or exactly
where to place it. This is a very extensive database used for storing about
9000 employee's info. and we are looking for the ability to shave off time by
making the date/time and who updated it fields automatic. I took care of the
date/time...but this ALIAS thing has got me stuck. Any help would be much
appreciated.
 
select suser_sname()


this works in the most popular flavors of Microsoft Access
 
Do you want the information to be saved for who created the record, and at
what time

Or, are you looking for the last user + time the record was updated?

If you looking for create time, then you can place the following code in the
before-insert event:


Me.LastTimeDateUpdate = now()
me.LastUser = fosuerName()

if you looking for saving the last person, then move the above code to the
forms before update event,

Me.LastTimeDateUpdate = now()
me.LastUser = fosuerName()


And, if you wanted, you could have 4 fields (two for who created the
record..and the two for who last updated the record).


The code you need for the network logon name can be found here:

You can get the current network logon name with:

http://www.mvps.org/access/api/api0008.htm

And, the current computer name with:

http://www.mvps.org/access/api/api0009.htm

And, if using ms-access security, then currentuser() will return the
ms-access logon.

I often log all 3 of the above values in some of my applications.

If you look at the lower left of the following screen shots (the 2nd
screen).

You a see that I display all 3 values:

http://www.kallal.ca/ridestutorialp/setdriver.htm

To use the above code examples, simply create a standard code module (call
it module1), and the paste in the code examples in the links...
 
Hi Albert,

I seem to get an error message on my form. Expected variable or precedure,
not module. Any reason why I would be getting this error?
 

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

Back
Top