Forcing a save of bound form

J

Jayyde

If I set Me.Dirty = False will it still fire off either the BeforeInsert or
BeforeUpdate events? I just want to make sure that this happens so I can
still validate the data before it saves it.

TIA,

Jayyde
 
R

Rick Brandt

Jayyde said:
If I set Me.Dirty = False will it still fire off either the
BeforeInsert or BeforeUpdate events? I just want to make sure that
this happens so I can still validate the data before it saves it.

TIA,

Jayyde

BeforeInsert would not fire when the record is saved in any case. It fires
when a new record is first "dirtied" by the user. If the first dirtying of
a new record is done programmatically then BeforeInsert does not fire.

AfterInsert and BeforeUpdate should both fire when a new record is saved and
it would not matter what mechanism was used to invoke the save.
 
B

BruceM

Any attempt to save the record, whether by navigating to another record,
closing the database, or explicitly saving the record (such as with Me.Dirty
= False) will cause the form's Before Update to run. Before Update is a
good place to perform form-level data validation. Before Insert applies
only to when you first start typing in a new record (if I understand
correctly), so data validation can't occur there.
 
J

Jayyde

Thanks guys, that's what I needed to know :).


BruceM said:
Any attempt to save the record, whether by navigating to another record,
closing the database, or explicitly saving the record (such as with
Me.Dirty = False) will cause the form's Before Update to run. Before
Update is a good place to perform form-level data validation. Before
Insert applies only to when you first start typing in a new record (if I
understand correctly), so data validation can't occur there.
 
Top