Home All Groups Group Topic Archive Search About

User Tracking in Access

Author
1 Nov 2005 3:27 PM
Cgilsy
My office runs an Access database, and I have need to be able to view when
each employee logs in/logs out....Are there any thoughts on this???   I would
also like to be able to track whom was the last user to change a record...any
help would be appreciated.
Thanks

Author
1 Nov 2005 3:45 PM
Rick B
Both of these are asked pretty often.  Do a search and read the previous
posts on how to log user access to the database, and how to timestamp
changes.  You could also look at how to do audit trails if you want to track
what changes were made to the data.

--
Rick B



Show quoteHide quote
"Cgilsy" <Cgi***@discussions.microsoft.com> wrote in message
news:295AEE9E-0706-425B-A6A9-0F648740F2D6@microsoft.com...
> My office runs an Access database, and I have need to be able to view when
> each employee logs in/logs out....Are there any thoughts on this???   I
> would
> also like to be able to track whom was the last user to change a
> record...any
> help would be appreciated.
> Thanks
>
Author
2 Nov 2005 3:01 PM
miao
I don't know ,please
Author
1 Nov 2005 3:54 PM
Keith
"Cgilsy" <Cgi***@discussions.microsoft.com> wrote in message
news:295AEE9E-0706-425B-A6A9-0F648740F2D6@microsoft.com...
> My office runs an Access database, and I have need to be able to view when
> each employee logs in/logs out....Are there any thoughts on this???   I
> would
> also like to be able to track whom was the last user to change a
> record...any
> help would be appreciated.
> Thanks
>

Yes, Access can do this.  Check out the help for the "ENVIRON" property.  I
use this to gather network user information for audit purposes.

To track "last changed by" (and when) you'd need two new fields in your main
table, one for name and the other for date/time.  You would update the
fields using your form's BeforeUpdate event.  It is also possible to create
an audit trail of changes using a similar method.  Hope that's enough to get
you started.

Regards,
Keith.
www.keithwilby.com
Author
2 Nov 2005 2:08 PM
miao
Keith:
  I don't know ,please
Author
2 Nov 2005 7:57 PM
Secret Squirrel
Keith,
How would you set up the code in the BeforeUpdate Event? I would like to use
this as well.

Thanks

Show quoteHide quote
"Keith" wrote:

> "Cgilsy" <Cgi***@discussions.microsoft.com> wrote in message
> news:295AEE9E-0706-425B-A6A9-0F648740F2D6@microsoft.com...
> > My office runs an Access database, and I have need to be able to view when
> > each employee logs in/logs out....Are there any thoughts on this???   I
> > would
> > also like to be able to track whom was the last user to change a
> > record...any
> > help would be appreciated.
> > Thanks
> >
>
> Yes, Access can do this.  Check out the help for the "ENVIRON" property.  I
> use this to gather network user information for audit purposes.
>
> To track "last changed by" (and when) you'd need two new fields in your main
> table, one for name and the other for date/time.  You would update the
> fields using your form's BeforeUpdate event.  It is also possible to create
> an audit trail of changes using a similar method.  Hope that's enough to get
> you started.
>
> Regards,
> Keith.
> www.keithwilby.com
>
>
>
Author
3 Nov 2005 9:10 AM
Keith
"Secret Squirrel" <secretsquir***@discussions.microsoft.com> wrote in
message news:CAF4D5BF-08F0-4BED-95B6-3B9013138A5F@microsoft.com...
> Keith,
> How would you set up the code in the BeforeUpdate Event? I would like to
> use
> this as well.
>

Something like:

Dim strUserName As String
strUserName = Environ("USERNAME")
Me.txtUser = strUserName
Me.txtUpdated = Now()

Regards,
Keith.
www.keithwilby.com
Author
3 Nov 2005 5:07 PM
Secret Squirrel
Keith,
What if I wanted to expand this to show user tracking for each field? Can I
create another table to keep this information? If so, how would I go about
that?

Show quoteHide quote
"Keith" wrote:

> "Secret Squirrel" <secretsquir***@discussions.microsoft.com> wrote in
> message news:CAF4D5BF-08F0-4BED-95B6-3B9013138A5F@microsoft.com...
> > Keith,
> > How would you set up the code in the BeforeUpdate Event? I would like to
> > use
> > this as well.
> >
>
> Something like:
>
> Dim strUserName As String
> strUserName = Environ("USERNAME")
> Me.txtUser = strUserName
> Me.txtUpdated = Now()
>
> Regards,
> Keith.
> www.keithwilby.com
>
>
>
Author
4 Nov 2005 8:51 AM
Keith W
"Secret Squirrel" <secretsquir***@discussions.microsoft.com> wrote in
message news:47C20040-7199-470F-B7C1-AE6196E446F9@microsoft.com...
> Keith,
> What if I wanted to expand this to show user tracking for each field? Can
> I
> create another table to keep this information? If so, how would I go about
> that?
>
> "Keith" wrote:
>

Yes, create a new table with fields for time stamps, user ID, record ID and
old and new values.  You'd then need to use the before/after update events
on your forms to trigger the recording of the data.  It's not a two minute
job though.

Regards,
Keith.
www.keithwilby.com
Author
4 Nov 2005 2:56 PM
Secret Squirrel
How would I link this new tracking table to the table I want to track?

Show quoteHide quote
"Keith W" wrote:

> "Secret Squirrel" <secretsquir***@discussions.microsoft.com> wrote in
> message news:47C20040-7199-470F-B7C1-AE6196E446F9@microsoft.com...
> > Keith,
> > What if I wanted to expand this to show user tracking for each field? Can
> > I
> > create another table to keep this information? If so, how would I go about
> > that?
> >
> > "Keith" wrote:
> >
>
> Yes, create a new table with fields for time stamps, user ID, record ID and
> old and new values.  You'd then need to use the before/after update events
> on your forms to trigger the recording of the data.  It's not a two minute
> job though.
>
> Regards,
> Keith.
> www.keithwilby.com
>
>
>
Author
4 Nov 2005 5:35 PM
Joan Wild
You might want to study what Allen Browne has on this.
Creating an Audit Log
http://www.allenbrowne.com/AppAudit.html

--
Joan Wild
Microsoft Access MVP

Secret Squirrel wrote:
Show quoteHide quote
> How would I link this new tracking table to the table I want to track?
>
> "Keith W" wrote:
>
>> "Secret Squirrel" <secretsquir***@discussions.microsoft.com> wrote in
>> message news:47C20040-7199-470F-B7C1-AE6196E446F9@microsoft.com...
>>> Keith,
>>> What if I wanted to expand this to show user tracking for each
>>> field? Can I
>>> create another table to keep this information? If so, how would I
>>> go about that?
>>>
>>> "Keith" wrote:
>>>
>>
>> Yes, create a new table with fields for time stamps, user ID, record
>> ID and old and new values.  You'd then need to use the before/after
>> update events on your forms to trigger the recording of the data.
>> It's not a two minute job though.
>>
>> Regards,
>> Keith.
>> www.keithwilby.com
Author
4 Nov 2005 6:44 PM
Secret Squirrel
Ok I've followed the instructions from the link you gave me but I'm a little
unclear what he means by removing the 4 references to the function
"LogError()". Can you shed some light on how I remove these and where they
are located?

Show quoteHide quote
"Joan Wild" wrote:

> You might want to study what Allen Browne has on this.
> Creating an Audit Log
http://www.allenbrowne.com/AppAudit.html
>
> --
> Joan Wild
> Microsoft Access MVP
>
> Secret Squirrel wrote:
> > How would I link this new tracking table to the table I want to track?
> >
> > "Keith W" wrote:
> >
> >> "Secret Squirrel" <secretsquir***@discussions.microsoft.com> wrote in
> >> message news:47C20040-7199-470F-B7C1-AE6196E446F9@microsoft.com...
> >>> Keith,
> >>> What if I wanted to expand this to show user tracking for each
> >>> field? Can I
> >>> create another table to keep this information? If so, how would I
> >>> go about that?
> >>>
> >>> "Keith" wrote:
> >>>
> >>
> >> Yes, create a new table with fields for time stamps, user ID, record
> >> ID and old and new values.  You'd then need to use the before/after
> >> update events on your forms to trigger the recording of the data.
> >> It's not a two minute job though.
> >>
> >> Regards,
> >> Keith.
> >> www.keithwilby.com
>
>
>
Author
4 Nov 2005 6:52 PM
Joan Wild
I haven't used it, but a quick perusal...  He says to "copy this code" to a
new module.  If you search that code for logerror, you'll find 5 statements
like

Call LogError(....
Just put an apostrophe at the beginning of these lines.


--
Joan Wild
Microsoft Access MVP

Secret Squirrel wrote:
Show quoteHide quote
> Ok I've followed the instructions from the link you gave me but I'm a
> little unclear what he means by removing the 4 references to the
> function "LogError()". Can you shed some light on how I remove these
> and where they are located?
>
> "Joan Wild" wrote:
>
>> You might want to study what Allen Browne has on this.
>> Creating an Audit Log
>>  http://www.allenbrowne.com/AppAudit.html
>>
>> --
>> Joan Wild
>> Microsoft Access MVP
>>
>> Secret Squirrel wrote:
>>> How would I link this new tracking table to the table I want to
>>> track?
>>>
>>> "Keith W" wrote:
>>>
>>>> "Secret Squirrel" <secretsquir***@discussions.microsoft.com> wrote
>>>> in message
>>>> news:47C20040-7199-470F-B7C1-AE6196E446F9@microsoft.com...
>>>>> Keith,
>>>>> What if I wanted to expand this to show user tracking for each
>>>>> field? Can I
>>>>> create another table to keep this information? If so, how would I
>>>>> go about that?
>>>>>
>>>>> "Keith" wrote:
>>>>>
>>>>
>>>> Yes, create a new table with fields for time stamps, user ID,
>>>> record ID and old and new values.  You'd then need to use the
>>>> before/after update events on your forms to trigger the recording
>>>> of the data. It's not a two minute job though.
>>>>
>>>> Regards,
>>>> Keith.
>>>> www.keithwilby.com
Author
4 Nov 2005 7:27 PM
Secret Squirrel
Ok I did that now I'm getting an error "Method or data number not found".
Here is the line it is referring to. Can you help with this one?

Private Sub Form_BeforeUpdate(Cancel As Integer)

    bWasNewRecord = Me.NewRecord
    Call AuditEditBegin("tblRMA", "audtmpRMA", "RMA", Nz(Me.RMA, 0),
bWasNewRecord)




Show quoteHide quote
"Joan Wild" wrote:

> I haven't used it, but a quick perusal...  He says to "copy this code" to a
> new module.  If you search that code for logerror, you'll find 5 statements
> like
>
> Call LogError(....
> Just put an apostrophe at the beginning of these lines.
>
>
> --
> Joan Wild
> Microsoft Access MVP
>
> Secret Squirrel wrote:
> > Ok I've followed the instructions from the link you gave me but I'm a
> > little unclear what he means by removing the 4 references to the
> > function "LogError()". Can you shed some light on how I remove these
> > and where they are located?
> >
> > "Joan Wild" wrote:
> >
> >> You might want to study what Allen Browne has on this.
> >> Creating an Audit Log
> >>  http://www.allenbrowne.com/AppAudit.html
> >>
> >> --
> >> Joan Wild
> >> Microsoft Access MVP
> >>
> >> Secret Squirrel wrote:
> >>> How would I link this new tracking table to the table I want to
> >>> track?
> >>>
> >>> "Keith W" wrote:
> >>>
> >>>> "Secret Squirrel" <secretsquir***@discussions.microsoft.com> wrote
> >>>> in message
> >>>> news:47C20040-7199-470F-B7C1-AE6196E446F9@microsoft.com...
> >>>>> Keith,
> >>>>> What if I wanted to expand this to show user tracking for each
> >>>>> field? Can I
> >>>>> create another table to keep this information? If so, how would I
> >>>>> go about that?
> >>>>>
> >>>>> "Keith" wrote:
> >>>>>
> >>>>
> >>>> Yes, create a new table with fields for time stamps, user ID,
> >>>> record ID and old and new values.  You'd then need to use the
> >>>> before/after update events on your forms to trigger the recording
> >>>> of the data. It's not a two minute job though.
> >>>>
> >>>> Regards,
> >>>> Keith.
> >>>> www.keithwilby.com
>
>
>
Author
4 Nov 2005 8:37 PM
Joan Wild
That function has four arguments not five as in your statement.

Function AuditDelBegin(sTable As String, sAudTmpTable As String, sKeyField
As String, lngKeyValue As Long) As Boolean

It also appears as though your KeyValue might be null?  That doesn't make
sense to me.

--
Joan Wild
Microsoft Access MVP

Secret Squirrel wrote:
Show quoteHide quote
> Ok I did that now I'm getting an error "Method or data number not
> found". Here is the line it is referring to. Can you help with this
> one?
>
> Private Sub Form_BeforeUpdate(Cancel As Integer)
>
>    bWasNewRecord = Me.NewRecord
>    Call AuditEditBegin("tblRMA", "audtmpRMA", "RMA", Nz(Me.RMA, 0),
> bWasNewRecord)
>
>
>
>
> "Joan Wild" wrote:
>
>> I haven't used it, but a quick perusal...  He says to "copy this
>> code" to a new module.  If you search that code for logerror, you'll
>> find 5 statements like
>>
>> Call LogError(....
>> Just put an apostrophe at the beginning of these lines.
>>
>>
>> --
>> Joan Wild
>> Microsoft Access MVP
>>
>> Secret Squirrel wrote:
>>> Ok I've followed the instructions from the link you gave me but I'm
>>> a little unclear what he means by removing the 4 references to the
>>> function "LogError()". Can you shed some light on how I remove these
>>> and where they are located?
>>>
>>> "Joan Wild" wrote:
>>>
>>>> You might want to study what Allen Browne has on this.
>>>> Creating an Audit Log
>>>>  http://www.allenbrowne.com/AppAudit.html
>>>>
>>>> --
>>>> Joan Wild
>>>> Microsoft Access MVP
>>>>
>>>> Secret Squirrel wrote:
>>>>> How would I link this new tracking table to the table I want to
>>>>> track?
>>>>>
>>>>> "Keith W" wrote:
>>>>>
>>>>>> "Secret Squirrel" <secretsquir***@discussions.microsoft.com>
>>>>>> wrote in message
>>>>>> news:47C20040-7199-470F-B7C1-AE6196E446F9@microsoft.com...
>>>>>>> Keith,
>>>>>>> What if I wanted to expand this to show user tracking for each
>>>>>>> field? Can I
>>>>>>> create another table to keep this information? If so, how would
>>>>>>> I go about that?
>>>>>>>
>>>>>>> "Keith" wrote:
>>>>>>>
>>>>>>
>>>>>> Yes, create a new table with fields for time stamps, user ID,
>>>>>> record ID and old and new values.  You'd then need to use the
>>>>>> before/after update events on your forms to trigger the recording
>>>>>> of the data. It's not a two minute job though.
>>>>>>
>>>>>> Regards,
>>>>>> Keith.
>>>>>> www.keithwilby.com
Author
4 Nov 2005 8:48 PM
Secret Squirrel
I figured out the problem for this one. He had "(Me.InvoiceID, 0)" on the
website. I changed it to "(Me!InvoiceID, 0)" and now it works fine. I guess
it was just a typo on his part. Unless I'm missing something here???

Show quoteHide quote
"Joan Wild" wrote:

> That function has four arguments not five as in your statement.
>
> Function AuditDelBegin(sTable As String, sAudTmpTable As String, sKeyField
> As String, lngKeyValue As Long) As Boolean
>
> It also appears as though your KeyValue might be null?  That doesn't make
> sense to me.
>
> --
> Joan Wild
> Microsoft Access MVP
>
> Secret Squirrel wrote:
> > Ok I did that now I'm getting an error "Method or data number not
> > found". Here is the line it is referring to. Can you help with this
> > one?
> >
> > Private Sub Form_BeforeUpdate(Cancel As Integer)
> >
> >    bWasNewRecord = Me.NewRecord
> >    Call AuditEditBegin("tblRMA", "audtmpRMA", "RMA", Nz(Me.RMA, 0),
> > bWasNewRecord)
> >
> >
> >
> >
> > "Joan Wild" wrote:
> >
> >> I haven't used it, but a quick perusal...  He says to "copy this
> >> code" to a new module.  If you search that code for logerror, you'll
> >> find 5 statements like
> >>
> >> Call LogError(....
> >> Just put an apostrophe at the beginning of these lines.
> >>
> >>
> >> --
> >> Joan Wild
> >> Microsoft Access MVP
> >>
> >> Secret Squirrel wrote:
> >>> Ok I've followed the instructions from the link you gave me but I'm
> >>> a little unclear what he means by removing the 4 references to the
> >>> function "LogError()". Can you shed some light on how I remove these
> >>> and where they are located?
> >>>
> >>> "Joan Wild" wrote:
> >>>
> >>>> You might want to study what Allen Browne has on this.
> >>>> Creating an Audit Log
> >>>>  http://www.allenbrowne.com/AppAudit.html
> >>>>
> >>>> --
> >>>> Joan Wild
> >>>> Microsoft Access MVP
> >>>>
> >>>> Secret Squirrel wrote:
> >>>>> How would I link this new tracking table to the table I want to
> >>>>> track?
> >>>>>
> >>>>> "Keith W" wrote:
> >>>>>
> >>>>>> "Secret Squirrel" <secretsquir***@discussions.microsoft.com>
> >>>>>> wrote in message
> >>>>>> news:47C20040-7199-470F-B7C1-AE6196E446F9@microsoft.com...
> >>>>>>> Keith,
> >>>>>>> What if I wanted to expand this to show user tracking for each
> >>>>>>> field? Can I
> >>>>>>> create another table to keep this information? If so, how would
> >>>>>>> I go about that?
> >>>>>>>
> >>>>>>> "Keith" wrote:
> >>>>>>>
> >>>>>>
> >>>>>> Yes, create a new table with fields for time stamps, user ID,
> >>>>>> record ID and old and new values.  You'd then need to use the
> >>>>>> before/after update events on your forms to trigger the recording
> >>>>>> of the data. It's not a two minute job though.
> >>>>>>
> >>>>>> Regards,
> >>>>>> Keith.
> >>>>>> www.keithwilby.com
>
>
>