Forms and 'Dirty' property

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?
 
T

Trias

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?
 
D

David

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:
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top