Connecting Tech Pros Worldwide Help | Site Map

Security

Stuart Masters
Guest
 
Posts: n/a
#1: Nov 12 '05
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
Terry Kreft
Guest
 
Posts: n/a
#2: Nov 12 '05

re: Security


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" <stuart.masters@pcs-tr.swest.nhs.uk> wrote in message
news:60fe95cc.0404210552.5f4b3acf@posting.google.c om...[color=blue]
> 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[/color]


Stuart Masters
Guest
 
Posts: n/a
#3: Nov 12 '05

re: Security


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!
Terry Kreft
Guest
 
Posts: n/a
#4: Nov 12 '05

re: Security



Rename the text box to something else (e.g. txtOSUserName).


--
Terry Kreft
MVP Microsoft Access


"Stuart Masters" <stuart.masters@pcs-tr.swest.nhs.uk> wrote in message
news:40878b40$0$206$75868355@news.frii.net...[color=blue]
> 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![/color]


Closed Thread