Results 1 to 3 of 3
  1. #1
    New Lounger
    Join Date
    Dec 2006
    Posts
    21
    Thanks
    0
    Thanked 0 Times in 0 Posts

    nicks continuing newbie questions... (2003)

    Hopefully, this is the last of the questions, lol...

    I want to put a date/time stamp on a record when I save it, whcih can be displayed on a form, or on a report. This needs to be the date/time that the record was first saved on - and mustn't change if any ammendments are made. Ideally, I'd like to save any subsequant ammendment dates as well, to produce an audit trail. Is this all possible?

    Thanks again...

    Nick

  2. #2
    Gold Lounger
    Join Date
    Jun 2001
    Location
    Crystal Beach, FL, Florida, USA
    Posts
    3,436
    Thanks
    1
    Thanked 34 Times in 34 Posts

    Re: nicks continuing newbie questions... (2003)

    Easy. Just add a Date/Time field to your table, and call it something like "DateTimeAdded". Set the DefaultValue to: Now()
    Mark Liquorman
    See my website for Tips & Downloads and for my Liquorman Utilities.

  3. #3
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: nicks continuing newbie questions... (2003)

    To store the create date and last modified date (and time) of a record:

    Open the table in design view.
    Add two date/time fields: DateCreated and DateModified.
    Set the Default Value property of the DateCreated field to <code>Now()</code>

    On the form used to enter/edit date, put code in the Before Update event of the form:

    Private Sub Form_BeforeUpdate()
    Me.DateModified = Now
    End Sub

    This will only save the last time the record was saved. If you want an audit trail, see <post:=320,697>post 320,697</post:> for a simplistic approach, and see Allen Browne - Creating an Audit Log for a more complete solution.

Posting Permissions

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