Forms and 'Dirty' property

  • Thread starter Thread starter David
  • Start date Start date
D

David

None of my tables columns have the 'required' property set
because I dont want Access generated messages. So I need
to check these conditions myself and prevent the record
being updated.
I have a case where a subform with many rows is updated.
When the user clicks in the Employee combo box, I
automatically fill in default data from other tables.
However, if the user exits without selecting an Employee,
this is an invalid condition. How do I prevent the record
from being added to the table, since Access does this
automatically? Is the 'Dirty' properyty the answer?
 
Hi,
is there a reason why you put the automatic fill in procedure in the combobox OnClick?. Probably, a better place is in the combobox AfterUpdate event. This way the procedure will be fired if user select an Employee.
However try using Form's BeforeUpdate event to do some data validation. This event is fired before the actual data gets stored. In your form beforeUpdate put something like this:

if isnull(me.Employee) than
me.undo
end if

HTH
----- David wrote: -----

None of my tables columns have the 'required' property set
because I dont want Access generated messages. So I need
to check these conditions myself and prevent the record
being updated.
I have a case where a subform with many rows is updated.
When the user clicks in the Employee combo box, I
automatically fill in default data from other tables.
However, if the user exits without selecting an Employee,
this is an invalid condition. How do I prevent the record
from being added to the table, since Access does this
automatically? Is the 'Dirty' properyty the answer?
 
Do I have to put it in the BeforeInsert event as well ?
-----Original Message-----
Hi,
is there a reason why you put the automatic fill in
procedure in the combobox OnClick?. Probably, a better
place is in the combobox AfterUpdate event. This way the
procedure will be fired if user select an Employee.
However try using Form's BeforeUpdate event to do some
data validation. This event is fired before the actual
data gets stored. In your form beforeUpdate put something
like this:
 
Back
Top