Hi,
I have a date field in my table. I have a form for this table. In the
after update event for the form, I have this:
Private Sub Form_AfterUpdate()
LST_UPD = Now()
End Sub
When I tried testing this I got all kinds of errors, first after I edit
the record on the form the date gets posted to the LST_UPD field, but I
can't go to the next record, and when I try to quit the form it tells
me that I can't save the current record and sometimes when afterwords I
get back in the form I get #deleted...my record is gone....
so I added this:
Private Sub Form_AfterUpdate()
LST_UPD = Now()
Me!refresh
End Sub
and now I get error 2115.
I just want a date posted in a field everytime a record is updated, but
I may be going about this in the wrong way?
thanks in advance for assistance.
David W. Fenton - 09 Jul 2005 02:08 GMT
> I have a date field in my table. I have a form for this table. In
> the after update event for the form, I have this:
>
> Private Sub Form_AfterUpdate()
> LST_UPD = Now()
> End Sub
This will put you in an endless loop.
Look at it this way:
1. record changes are saved.
2. after the update, data in the record is changed.
3. thus, the record had been changed, and the data needs to be
saved.
4. loop back to 2).
Stamp the update date/time in the BeforeUpdate event of the form,
instead. That happens *before* the update, so the change to the data
doesn't retrigger the same event.
And, yes, I made the same mistake way back when.
(and this isn't a replication issue, either)

Signature
David W. Fenton http://www.bway.net/~dfenton
dfenton at bway dot net http://www.bway.net/~dfassoc