Google
 
Webnews.only-4-geeks.com
Interesting places
news.only-4-geeks.com Forum Index » Access

Access 2007 when a record is modified, I want to store UserN

 
Jump to:  
 
unfortune8
PostPosted: Wed Sep 03, 2008 1:54 pm    Post subject: Access 2007 when a record is modified, I want to store UserN
       
Now that there aren't user groups and permissions in 2007, how do I store the
name of the person that has modified a record.
 

 
ErezM via AccessMonster.c
PostPosted: Wed Sep 03, 2008 2:57 pm    Post subject: Re: Access 2007 when a record is modified, I want to store U
       
you need to add a ModifiedBy field to every table you need auditing for, and
then pick the user name by an entry form that asks for the user name or you
can tell the windows/network user name of the currenctly logged in user by

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

put all this in a module, so you can access it from anywhere in the db

unfortune8 wrote:
Quote:
Now that there aren't user groups and permissions in 2007, how do I store the
name of the person that has modified a record.

--
May all beings be happy.

Message posted via AccessMonster.com
LINK
 

 
unfortune8
PostPosted: Wed Sep 03, 2008 5:05 pm    Post subject: Re: Access 2007 when a record is modified, I want to store U
       
Thanks for the response. Unfortunately, I'm not familiar with VB coding or
working with modules. I've copied the code you gave into a module, but don't
know where to go from there. If you can provide any additional direction,
that would be great.

"ErezM via AccessMonster.com" wrote:

Quote:
you need to add a ModifiedBy field to every table you need auditing for, and
then pick the user name by an entry form that asks for the user name or you
can tell the windows/network user name of the currenctly logged in user by

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

put all this in a module, so you can access it from anywhere in the db

unfortune8 wrote:
Now that there aren't user groups and permissions in 2007, how do I store the
name of the person that has modified a record.

--
May all beings be happy.

Message posted via AccessMonster.com
LINK

 

 
NetworkTrade
PostPosted: Wed Sep 03, 2008 7:32 pm    Post subject: RE: Access 2007 when a record is modified, I want to store U
       
just fyi

User level security remains available in 07 if the database is mdb.

It is the new 07 accdb that does not have user level security.

--
NTC


"unfortune8" wrote:

Quote:
Now that there aren't user groups and permissions in 2007, how do I store the
name of the person that has modified a record.
 

 
ErezM via AccessMonster.c
PostPosted: Wed Sep 03, 2008 8:15 pm    Post subject: Re: Access 2007 when a record is modified, I want to store U
       
if you're not using code at all, it's a bit hard to use that method, but to
finish what i started, if the code i wrote is in a new module,
add the field [ModifiedBy] mentioned earlier as a hidden field on every form
you need it, and then use the form's BeforeUpdate event write
ModifiedBy=fOSUserName

this will set the field ModifiedBy To the current user every time the record
is updated

unfortune8 wrote:
Quote:
Thanks for the response. Unfortunately, I'm not familiar with VB coding or
working with modules. I've copied the code you gave into a module, but don't
know where to go from there. If you can provide any additional direction,
that would be great.

you need to add a ModifiedBy field to every table you need auditing for, and
then pick the user name by an entry form that asks for the user name or you
[quoted text clipped - 21 lines]
Now that there aren't user groups and permissions in 2007, how do I store the
name of the person that has modified a record.

--
May all beings be happy.

Message posted via AccessMonster.com
LINK
 

Page 1 of 1 .:.

Google
 
Webnews.only-4-geeks.com

Windows Update | C++ | C | PHP | JavaScript | Photoshop | Programming | Windows 2000 | Python | Windows XP | Object | Flash | Flash - ActionScript | Paint Shop Pro | Excel | PowerPoint | Access | Word | Windows 98 | Internet Explorer 6.0 | CorelDraw12 | Java | XML | asm x86 | Linux Mandrake | Linux RedHat | Outlook |  | news from newsgroups |_ | s

Web Templates

Awesome Website Templates ©

opony darmowe filmy erotyczne Poker in Poland darowizna najlepsze filmy