Dirty not picking up new record

J

Jonathan

I have an Access 2003 database where a user starts a new record. I have code
on the form that checks to see if a new record has been started in the close
event:-

If me.dirty then
ValidateRecord
end if

Unfortunatelty the code isn't picking up that a new record has been created
when the user goes File|Exit, which leaves blank records in the database.
 
D

Dale_Fye via AccessMonster.com

You might also want to try:

me.NewRecord

It could be that the user is on a NewRecord, but if none of the fields have a
value, me.Dirty will return False.

HTH
Dale
 
D

Dirk Goldgar

Jonathan said:
I have an Access 2003 database where a user starts a new record. I have
code
on the form that checks to see if a new record has been started in the
close
event:-

If me.dirty then
ValidateRecord
end if

Unfortunatelty the code isn't picking up that a new record has been
created
when the user goes File|Exit, which leaves blank records in the database.


In the Close event? By the time the form's Close event fires, the record
has already been saved. Validation of a record should take place in the
form's BeforeUpdate event.
 
Top