last updated - date AND user

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • jayme
    New Member
    • Mar 2007
    • 83

    last updated - date AND user

    is there a way to have my form automatically record when a record is changed? i figured how to make the date update JUST if you change a record, but i also wanted to have it record the user that was logged in and made that change as well.
    currently i made a macro under BeforeUpdate event for the form for my LastUpdated field and it puts the date in when the record has been changed. i have a field for the UpdatedBy but it just fills in whoever is logged in at the time-it doesnt necessarily put the user that changed that record. hope that makes sense.
    any ideas on how to have both fields update?
  • Denburt
    Recognized Expert Top Contributor
    • Mar 2007
    • 1356

    #2
    If you have user security in place for the database then you can simply call:

    currentUser()

    If you would like to know who logged into that P.C.

    Environ("UserNa me")

    There is also other methods Neopa has an example here where he pulls it out of the registry:


    There are also several examples in this thread:

    Comment

    • jayme
      New Member
      • Mar 2007
      • 83

      #3
      currently i am using CurrentUser() in that field but it doesnt update when someone edits a record. it just has who is logged in.
      like-for the date the field is blank until i change something then hit save THEN it updates that field for the modified date. the user field doesnt necessarily change with WHO made the change. so i was thinking there had to be another way besides currentuser().
      ill look more into those other links you posted-maybe those have the answer im looking for.
      thank you!!

      Comment

      • Denburt
        Recognized Expert Top Contributor
        • Mar 2007
        • 1356

        #4
        I don't quite understand this:
        it just has who is logged in.
        Are you saying that you have a user account that several people use?

        Environ("UserNa me") Will give you the person logged into that P.C.

        Where are you using CurrentUser() are you placing this in the default value property, the control source, or VBA somewhere?

        I usually use it in my form using VBA under the On Dirty property.

        Comment

        • jayme
          New Member
          • Mar 2007
          • 83

          #5
          i did not know about the OnDirty event....learne d something new-once again! thank you!! sorry for not being able to explain my problem very well-but your help is definitely appreciated! i tried the OnDirty property for that and it worked! thanks so much!! that's exactly what i needed!

          Comment

          • Denburt
            Recognized Expert Top Contributor
            • Mar 2007
            • 1356

            #6
            Glad I could help, makes my morning knowing your all set.

            Comment

            • Denburt
              Recognized Expert Top Contributor
              • Mar 2007
              • 1356

              #7
              Oh just noticed one more thing are you using "date AND user" or "Date/Time and user" FYI, If your in the VBA window Date() gives you the date and Now() gives you date time info. have a nice day :)

              Comment

              • jayme
                New Member
                • Mar 2007
                • 83

                #8
                Originally posted by Denburt
                Oh just noticed one more thing are you using "date AND user" or "Date/Time and user" FYI, If your in the VBA window Date() gives you the date and Now() gives you date time info. have a nice day :)
                i was just using the Date() but I might give Now() a try and see what works for us. great...thank you!

                Comment

                Working...