Tracking Who Updates Records

C

charles.kendricks

I have a form which is used to input new customer data. The database
of which the form is a part is used by a number of different user. I
want to track which user input which records. I have a textbox in the
form which is not visible set to =CurrentUser(). I then have a
textbox bound to the UpdatedBy field in the customer records. I used
the OnDirty event of the form and set Me.UpdatedBy = Me.txtTmpUser,
thinking that UpdatedBy would contain the same data as txtTmpUser as
soon as any change was to the data in the form. But it's not working.
What am I doing wrong.
 
T

Tom Wickerath

Hi Charles,
I used the OnDirty event of the form...

I would do this in the Form_BeforeUpdate event procedure, instead of
Form_Dirty.

The CurrentUser function is useful for returning the user if, and only if,
you are using ULS (User Level Security), which you didn't mention. If this is
true, then just use:

Me.UpdatedBy = CurrentUser()

If you are not using ULS, then you can grab the NTUserID using this code:

Get Login name
http://www.mvps.org/access/api/api0008.htm

For example,
Me.UpdatedBy = fOSUserName()

(again, in Form_BeforeUpdate).

If you want to track all edits to a given record, then check out Access MVP
Allen Browne's Audit Log sample: http://allenbrowne.com/AppAudit.html

I highly recommend that you not post your *real* e-mail address in any
newsgroup posting. Doing so will only attract the unwanted attention of
spammers.


Tom Wickerath
Microsoft Access MVP
https://mvp.support.microsoft.com/profile/Tom
http://www.access.qbuilt.com/html/expert_contributors.html
__________________________________________
 
C

charles.kendricks

Tom,

I am indeed using ULS, and I didn't know that the CurrentUser had
that particular requirement, thank for the help with my particular
problem and the additional tip.
 
C

charles.kendricks

Tom,

I am indeed using ULS, and I didn't know that the CurrentUser had
that particular requirement, thank for the help with my particular
problem and the additional tip.















- Show quoted text -

Thanks to all who offered help. The answer to my problem came to me
literally while I was asleep last night. When I added the UpdatedBy,
and UpdateTime fields to the customer table and the CustomerInput
form, I stupidly forgot to update the query that provides the
recordset for the form when it's searching for customers by name.
 
T

Tom Wickerath

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top