Results 1 to 5 of 5
  1. #1
    2 Star Lounger
    Join Date
    Dec 2000
    Location
    Montreal, Quebec, Canada
    Posts
    115
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Modify date in an existing field.

    Easy code question.
    TableA has a Refdate field set to default date. I want to change the Refdate to today's date when the record is modified.
    In the data entry form I need to create a Before Update event procedure to change the date.
    Could someone help me with the code. I just can't do it.
    Thanks <img src=/S/nuts.gif border=0 width=15 height=15>

  2. #2
    3 Star Lounger
    Join Date
    Dec 2000
    Location
    USA
    Posts
    379
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Modify date in an existing field.

    Attach the following to the Before Update Event of the form:

    If Me.Dirty Then
    Me![RefDate] = Date
    End If

    The Dirty property determines whether the current record has been modified since it was last saved.

  3. #3
    3 Star Lounger
    Join Date
    Jan 2001
    Location
    Edmonton, Alberta, Canada
    Posts
    326
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Modify date in an existing field.

    Two things - Me.Dirty is only available in Access 2000 (the original questioner didn't say what version of Access they were using). Secondly, the beforeupdate event won't fire if the record hasn't changed, so you don't really need to check me.dirty in the beforeupdate event.

  4. #4
    Plutonium Lounger
    Join Date
    Dec 2000
    Location
    Sacramento, California, USA
    Posts
    16,775
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Modify date in an existing field.

    Sorry, but Me.Dirty has been around since at least Access 97. I can't remember whether that property was exposed in earlier versions or not.
    Charlotte

  5. #5
    3 Star Lounger
    Join Date
    Jan 2001
    Location
    Edmonton, Alberta, Canada
    Posts
    326
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Modify date in an existing field.

    Oops! I was about to argue with you until I realized that I was confusing the Dirty event (new in Access 2000) with the Dirty property. Sorry.

    The rest of my comment still stands. If the form isn't "dirty" the beforeupdate event won't fire, so there's no need to check if it's "dirty".

Posting Permissions

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