validating data when adding record

  • Thread starter Thread starter Gerry
  • Start date Start date
G

Gerry

Hi.
I'm a bit stumped. I have a simple form associated with a
table. When adding a record (via the record selector
button) I cannot setfocus of the fields after editing
them, in other words, I add logic to validate a field "On
Exit" and end it with .setfocus to that field - it
doesn't.

any help would be appreciated.

Thanks,
Gerry
 
Use the BeforeUpdate event of the control to validate it. If you are not
happy, just cancel the event.

If you need to compare fields, or check that a field was not left blank use
the BeforeUpdate event of the form.

SetFocus in the form's Exit event probably won't do much. The focus is still
in the control at that stage so it does nothing when you SetFocus. After the
event is over, it moves on to the next control.
 
Back
Top