1. Computer problem? Tech Support Guy is completely free -- paid for by advertisers and donations. Click here to join today! If you're new to Tech Support Guy, we highly recommend that you visit our Guide for New Members.

Trapping updates in continuous forms - Access

Discussion in 'Business Applications' started by gfg, Feb 1, 2007.

Thread Status:
Not open for further replies.
Advertisement
  1. gfg

    gfg Thread Starter

    Joined:
    Aug 18, 2005
    Messages:
    128
    Access 2003

    I must update a LateDateModified field in each record within a continuous form, everytime the record is changed.

    Placing code in AfterUpdate only updates the first record, regardless of which record is updated.

    Any suggestions?

    Thanks
     
  2. OBP

    OBP

    Joined:
    Mar 8, 2005
    Messages:
    19,895
    hello gfg, in which "After Update" event procedure are placing the code?
    If you want to record any change to the records then the best place for the code is in the Form's "On Dirty" event procedure.
    This works in a continuous form, I have just checked it and it updates the record that is changed.
    It will also allow for resetting the data should the person cancel out of the form without saving or updating taking place.
     
  3. gfg

    gfg Thread Starter

    Joined:
    Aug 18, 2005
    Messages:
    128
    Thanks - the AfterUpdate was the form's property - I tried the on dirty property - and it still does not work - I am changing a check box - would this matter?
     
  4. gfg

    gfg Thread Starter

    Joined:
    Aug 18, 2005
    Messages:
    128
    Here is my code:

    Private Sub Form_Dirty(Cancel As Integer)

    Dim rs As Recordset
    10 Set rs = Me.RecordsetClone

    20 rs.Edit
    30 rs("LastModifiedDate") = Now
    40 rs.Update

    50 Set rs = Nothing
    End Sub
     
  5. gfg

    gfg Thread Starter

    Joined:
    Aug 18, 2005
    Messages:
    128
    I wrote some code to tell me what record it is on after a record is updated - and it is always on record one
     
  6. Rockn

    Rockn

    Joined:
    Jul 29, 2001
    Messages:
    21,334
    If it is a bound form you could have a hidden text field with a default value of Date and when a record is updated insert the hidden fields value into the table.
     
  7. gfg

    gfg Thread Starter

    Joined:
    Aug 18, 2005
    Messages:
    128
    I figured it out -

    I needed to add the following code:

    rs.bookmark = me.bookmark

    DOH!
     
  8. OBP

    OBP

    Joined:
    Mar 8, 2005
    Messages:
    19,895
    gfg, you do not have to use a Recordset Clone at all.
    You can just put the following in the event procedure
    me.LastModifiedDate = Now
     
  9. Sponsor

As Seen On
As Seen On...

Welcome to Tech Support Guy!

Are you looking for the solution to your computer problem? Join our site today to ask your question. This site is completely free -- paid for by advertisers and donations.

If you're not already familiar with forums, watch our Welcome Guide to get started.

Join over 733,556 other people just like you!

Thread Status:
Not open for further replies.

Short URL to this thread: https://techguy.org/540240

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice