after insert and after update events (confusion)

  • Thread starter Thread starter GeorgeB
  • Start date Start date
G

GeorgeB

Hi,
I have created a form that fires VB after_insert and
after_update procedures.
I am using this to audit database changes (to eg table
Fred) to an audit table.
This works ok, however the after update event is fired
even when a record is inserted into Fred - this leads to 2
audit records being created (instead of 1).
Any body know why the after insert and update events are
firing when only an insert is taking place?
 
I built a dummy table and form to test this.

- When the form showed only 1 record, and when I entered a new record, the form fires off both procedures when I CHANGE which record is being viewed.

- When the form was a continuous form, after I inserted a new record and placed my cursor in one of the others, both procedures fired off.

- When I merely changed the value in one of the fields and moved to another one, only after_update fired off.

Doesn't make much sense does it? Appearantly inserting a new record is viewed as updating the table as well as inserting a new value into it. Weird huh? I wouldn't have coded it that way. I'd say just use after_update for your form. It should capture all changes/new records.

Tyler
 
It does look a bit confusing, but the After_Update event also fires when a
new record is being inserted. In fact, it fires before the After_Insert
event does.
 
Back
Top