Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / Queries / December 2005

Tip: Looking for answers? Try searching our database.

Current User

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
mmazenge@border.co.zw - 01 Dec 2005 09:33 GMT
Hi,

I have two users confiming one operation on my database and i need to
track the user by defaulting to the current user() i.e. logged on user.
Now setting the default value to Current User() only works if its a new
record, but i want it to work when editing as some of the data would
have been captured by some other user.

Thanks in advance

Memory
Allen Browne - 01 Dec 2005 09:43 GMT
Use the BeforeUpdate event of the *form* to record the name of the current
user into your field.

This example assigns the current user to the field named UpdatedBy:
   Private Sub Form_BeforeUdpdate(Cancel As Integer)
       Me.[UpdatedBy] = CurrentUser()
   End Sub

Signature

Allen Browne - Microsoft MVP.  Perth, Western Australia.
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

> I have two users confiming one operation on my database and i need to
> track the user by defaulting to the current user() i.e. logged on user.
[quoted text clipped - 5 lines]
>
> Memory
mmazenge@border.co.zw - 01 Dec 2005 10:06 GMT
Thanks but this will update the database, how will i then default the
value on the capturing form. My issue here is i ahve user A & B, doing
the same job and we need to track delays of certain documents i.e. an
order is approved by the finance department and User A may take 3 weeks
to place that order and then uses User B's credentials and i want to
avoid that.
How then can I default to CurrentUser() during editing??

Thanks

Regards

Memory
Allen Browne - 01 Dec 2005 10:16 GMT
I don't understand. Comments in-line.

Signature

Allen Browne - Microsoft MVP.  Perth, Western Australia.
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

> Thanks but this will update the database

You don't want to save the name of the current user who last changed the
record?

>, how will i then default the
> value on the capturing form.

The user does not have to see the field or enter anything. The value is
automatically inserted when the Form_BeforeUpdate runs.

> My issue here is i ahve user A & B, doing
> the same job and we need to track delays of certain documents i.e. an
> order is approved by the finance department and User A may take 3 weeks
> to place that order and then uses User B's credentials and i want to
> avoid that.

If the field not shown to the user, but assigned programmatically to the
field, you are still worried that the user may change this?

> How then can I default to CurrentUser() during editing??

By using the BeforeUpdate event of the form?
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.