Connecting Tech Pros Worldwide Help | Site Map

Security

 
LinkBack Thread Tools Search this Thread
  #1  
Old November 12th, 2005, 09:56 PM
Stuart Masters
Guest
 
Posts: n/a
Default Security

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

  #2  
Old November 12th, 2005, 09:57 PM
Terry Kreft
Guest
 
Posts: n/a
Default 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]


  #3  
Old November 12th, 2005, 09:58 PM
Stuart Masters
Guest
 
Posts: n/a
Default 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!
  #4  
Old November 12th, 2005, 10:06 PM
Terry Kreft
Guest
 
Posts: n/a
Default 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]


 

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Popular Articles

What is Bytes?

We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights. Get the best answers to your questions from over 220,840 network members.