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

Security

P: n/a
Hope someone out there can help.

I would like to set up a field to record the username and date of the
last person who amended a record. I would like to do this without
creating user and group accounts. Is there a way for Access to record
a users computer username and then record that name into a field along
with the date.

Any help would be much appreciated.

stu
Nov 12 '05 #1
Share this Question
Share on Google+
3 Replies


P: n/a
Look at

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

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

May also be useful to you.
--
Terry Kreft
MVP Microsoft Access
"Stuart Masters" <st************@pcs-tr.swest.nhs.uk> wrote in message
news:60**************************@posting.google.c om...
Hope someone out there can help.

I would like to set up a field to record the username and date of the
last person who amended a record. I would like to do this without
creating user and group accounts. Is there a way for Access to record
a users computer username and then record that name into a field along
with the date.

Any help would be much appreciated.

stu

Nov 12 '05 #2

P: n/a
Many thanks for the links you provided me with. However, I am having a
few problems. I hope you can help.

I have created a new text box called fOSUserName and then in code
created a new module. In this module I placed the code:

' This code was originally written by Dev Ashish.
' It is not to be altered or distributed,
' except as part of an application.
' You are free to use it in any application,
' provided the copyright notice is left unchanged.
'
' Code Courtesy of
' Dev Ashish
'
Private Declare Function apiGetUserName Lib "advapi32.dll" Alias _
"GetUserNameA" (ByVal lpBuffer As String, nSize As Long) As Long

Function fOSUserName() As String
' Returns the network login name
Dim lngLen As Long, lngX As Long
Dim strUserName As String
strUserName = String$(254, 0)
lngLen = 255
lngX = apiGetUserName(strUserName, lngLen)
If ( lngX > 0 ) Then
fOSUserName = Left$(strUserName, lngLen - 1)
Else
fOSUserName = vbNullString
End If
End Function

This code is not bringing up the current username and just leaves #Name?
in the text box. Could you please tell me where I'm going wrong.

Many thanks

Stu

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 12 '05 #3

P: n/a

Rename the text box to something else (e.g. txtOSUserName).
--
Terry Kreft
MVP Microsoft Access
"Stuart Masters" <st************@pcs-tr.swest.nhs.uk> wrote in message
news:40*********************@news.frii.net...
Many thanks for the links you provided me with. However, I am having a
few problems. I hope you can help.

I have created a new text box called fOSUserName and then in code
created a new module. In this module I placed the code:

' This code was originally written by Dev Ashish.
' It is not to be altered or distributed,
' except as part of an application.
' You are free to use it in any application,
' provided the copyright notice is left unchanged.
'
' Code Courtesy of
' Dev Ashish
'
Private Declare Function apiGetUserName Lib "advapi32.dll" Alias _
"GetUserNameA" (ByVal lpBuffer As String, nSize As Long) As Long

Function fOSUserName() As String
' Returns the network login name
Dim lngLen As Long, lngX As Long
Dim strUserName As String
strUserName = String$(254, 0)
lngLen = 255
lngX = apiGetUserName(strUserName, lngLen)
If ( lngX > 0 ) Then
fOSUserName = Left$(strUserName, lngLen - 1)
Else
fOSUserName = vbNullString
End If
End Function

This code is not bringing up the current username and just leaves #Name?
in the text box. Could you please tell me where I'm going wrong.

Many thanks

Stu

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!

Nov 12 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.