Results 1 to 3 of 3

Thread: Date Modified

  1. #1
    Join Date
    Sep 2007
    Posts
    3

    Post Unanswered: Date Modified

    Dear All,

    I'm working on a database to keep tracking of products going in and out.
    Most it works as I want it but there is one thing that I have not been able to implement yet.

    I would like a field that changes in the current date when the record is changed to see when any thing has changed for this product. It is supposed to work with the DateModified function I remember from a long time ago, but can't exactly recall it.

    I have a field called "Last Modified Date". In the table design view I would like to edit the "Default Value" but I can't figure out what to fill in here to get a modified date each time a record is changed.

    Thnx in advance!
    JLS

  2. #2
    Join Date
    Jan 2007
    Location
    UK
    Posts
    11,434
    Provided Answers: 10
    Default value will only be applied when the record is created - it will not change when a record does!

    Try using a default value of Now(). Then create a new record and see what the result is. Then modify the same record and see if it changes.

    Basically, you'll have to write it in your UPDATE statements / on save events to make sure that the date modified gets updated.
    George
    Home | Blog

  3. #3
    Join Date
    Nov 2003
    Posts
    1,487
    You already have the field in table ("Last Modified Date") for each record. Do you have a bound TextBox on Form to this table field? If not...then do so. Set its visible property to False if you like so no one can see it (whatever).

    Then in your Form's OnDirty Event perhaps have something like:

    Code:
    Private Sub Form_Dirty(Cancel As Integer)
       Me.LastModifiedDate = Now()
    End Sub
    .
    Environment:
    Self Taught In ALL Environments.....And It Shows!


Posting Permissions

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