Automatically adding date/time stamp to an edited record

Ask a Question related to Microsoft Access, Design and Development.

  1. #1

    Default Re: Automatically adding date/time stamp to an edited record

    To record just the date/time the record was created:
    Add a new Date/Time field to your table, and set its Default Value property
    to:
    =Now()

    To record the date/time the record was last updated, add a field to the
    table named (say) "UpdatedOn", and put this code into the BeforeUpdate event
    procedure of the form where records are edited:
    Private Sub Form_BeforeUpdate(Cancel As Integer)
    Me![UpdatedOn] = Now()
    End Sub

    To record a complete history of who edited/inserted/deleted which record
    when, recording both the old and new values each time, see:
    Audit Trail - Log changes at the record level
    at:
    [url]http://users.bigpond.net.au/abrowne1/AppAudit.html[/url]

    --
    Allen Browne - Microsoft MVP. Perth, Western Australia.
    Tips for Access users - [url]http://allenbrowne.com/tips.html[/url]
    Reply to the newsgroup. (Email address has spurious "_SpamTrap")

    "TylerT" <cwttwitch@yahoo.com> wrote in message
    news:69cf01c35844$f1979750$a001280a@phx.gbl...
    > I am trying to find some information on how I can have the
    > date and time stamp added to a record that a user edits in
    > a database. I need to be able to keep track of when the
    > record was modified without requiring the user to enter
    > this information. This is important for billing purposes
    > and for a call center. Any help would be great.
    >
    > Tyler

    Allen Browne Guest

  2. Similar Questions and Discussions

    1. Date and Time stamp on photo: how to remove
      I took some pictures in Europe this summer with my Coolpix 3100 and for about 20 of them had the date and time stamp turned on (printed in Orange)....
    2. Time/Date Stamp on Note
      Is there a way to turn off the time/date stamp on the Notes feature in Acrobat 5.0?
    3. Make DB2 UDB Date and Time Stamp Consistent With Win2000
      Hello, As somebody fairly new to DB2.. I am looking to migrate a V6 (No laughter please, it was a sandbox system hardly used at all)...
    4. Time Stamp on a record
      I have a subform within a form. When a user creates a new record in the subform, I would like to have the date/time automatically stamped on that...
    5. Date and Time stamp
      Without knowing what code/expressions/setup you're using, I would guess that the references on the Win 95 PCs are missing some library. Open up...
  3. #2

    Default Re: Automatically adding date/time stamp to an edited record

    Hi Tyler,

    Add a date field to the table (Every table you want to do this on). Also add
    that field to the form (or at least to the form's recordsource) then in the
    form for that table add code in the BeforeUpdate event to update that field:

    me.LastEdit=now()

    or

    me.LastEdit=date

    Use now() if you want a date and timestamp, Date if you want date only.

    In my applications I also log the Username of the user who last updated the
    record. If you have implemented Access Security you can easily get this
    information using the CurrentUser function

    me.LastUser = CurrentUser()


    --
    Sandra Daigle
    [Microsoft Access MVP]
    For the benefit of others please post all replies to this newsgroup.


    TylerT wrote:
    > I am trying to find some information on how I can have the
    > date and time stamp added to a record that a user edits in
    > a database. I need to be able to keep track of when the
    > record was modified without requiring the user to enter
    > this information. This is important for billing purposes
    > and for a call center. Any help would be great.
    >
    > Tyler
    Sandra Daigle Guest

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139