Trapping updates in continuous forms - Access

Status
This thread has been Locked and is not open to further replies. Please start a New Thread if you're having a similar issue. View our Welcome Guide to learn how to use this site.

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
 

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.
 

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?
 

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
 

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
 
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.
 

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!
 

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
 
Status
This thread has been Locked and is not open to further replies. Please start a New Thread if you're having a similar issue. View our Welcome Guide to learn how to use this site.

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

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 807,865 other people just like you!

Latest posts

Members online

Top