By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
443,482 Members | 1,002 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 443,482 IT Pros & Developers. It's quick & easy.

tracking users

P: n/a
I have a multi user database that I would like to be able to track user
actions. Ex Whenever a user creates a new employee record, I would
like to "stamp" their id on the record as the one that created it.
Also, whenever they run a report, I would like their id automatically
printed on the report as the one running it.
How to do this?

Oct 13 '06 #1
Share this Question
Share on Google+
3 Replies


P: n/a
Ryker wrote:
I have a multi user database that I would like to be able to track user
actions. Ex Whenever a user creates a new employee record, I would
like to "stamp" their id on the record as the one that created it.
Also, whenever they run a report, I would like their id automatically
printed on the report as the one running it.
How to do this?
If you have security installed, check out CurrentUser in help.
MsgBox("The current user is: " & CurrentUser)

If security is not installed then everyone's Admin. Maybe this link
http://www.mvps.org/access/api/api0066.htm will get you a name retrieval
method that's suitable.

Once you can get the name or loginid to Access, the rest is easy enough.
Oct 13 '06 #2

P: n/a
Wack this code into a new module, then call fntUserId and it will return the
NT user name

ie msgbox fntUserId()

=======================
Option Compare Database
Option Explicit

Public gstrUserId As String
Declare Function nmGetUserName Lib "advapi32.dll" Alias "GetUserNameA"
(ByVal lpBuffer As String, nSize As Long) As Long
Public Function fntUserId() As String
'get the loginid of the current NT user
Dim strBuffer As String * 20
Dim lngLenBuffer As Long
Dim lngOk As Long
lngLenBuffer = 20
lngOk = nmGetUserName(strBuffer, lngLenBuffer)
gstrUserId = Left(strBuffer, InStr(1, strBuffer, Chr(0)) - 1)
fntUserId = uCase(gstrUserId)
End Function
=======================
"Ryker" <ra*****@choctaw.orgwrote in message
news:11**********************@m7g2000cwm.googlegro ups.com...
>I have a multi user database that I would like to be able to track user
actions. Ex Whenever a user creates a new employee record, I would
like to "stamp" their id on the record as the one that created it.
Also, whenever they run a report, I would like their id automatically
printed on the report as the one running it.
How to do this?

Oct 15 '06 #3

P: n/a
Thanks, I will give this a try.
tombsy wrote:
Wack this code into a new module, then call fntUserId and it will return the
NT user name

ie msgbox fntUserId()

=======================
Option Compare Database
Option Explicit

Public gstrUserId As String
Declare Function nmGetUserName Lib "advapi32.dll" Alias "GetUserNameA"
(ByVal lpBuffer As String, nSize As Long) As Long
Public Function fntUserId() As String
'get the loginid of the current NT user
Dim strBuffer As String * 20
Dim lngLenBuffer As Long
Dim lngOk As Long
lngLenBuffer = 20
lngOk = nmGetUserName(strBuffer, lngLenBuffer)
gstrUserId = Left(strBuffer, InStr(1, strBuffer, Chr(0)) - 1)
fntUserId = uCase(gstrUserId)
End Function
=======================
"Ryker" <ra*****@choctaw.orgwrote in message
news:11**********************@m7g2000cwm.googlegro ups.com...
I have a multi user database that I would like to be able to track user
actions. Ex Whenever a user creates a new employee record, I would
like to "stamp" their id on the record as the one that created it.
Also, whenever they run a report, I would like their id automatically
printed on the report as the one running it.
How to do this?
Oct 16 '06 #4

This discussion thread is closed

Replies have been disabled for this discussion.