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.
 

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

Back
Top