Validating a entry

N

Nuno Gomes

Hello,


I have a form liked to a table and my goal is not to enter the field NUM
null or repited.

I put some code (to check the repeated) in Private Sub NUM_Exit(Cancel As
Integer) event, but a have some problems...
What is the best way to do it?...




thanks,
Nuno Gomes
 
J

John W. Vinson

Hello,


I have a form liked to a table and my goal is not to enter the field NUM
null or repited.

I put some code (to check the repeated) in Private Sub NUM_Exit(Cancel As
Integer) event, but a have some problems...
What is the best way to do it?...

First off, make the field Required in your table (so it can't be null) and
also use the Index property of the field to create a unique Index.

For a friendlier error message, use the Form's BeforeUpdate event; this can
also be cancelled, and (unlike the exit event of the Control) it will always
fire if the record is being updated. The Exit event will never fire if the
user doesn't actually select the NUM textbox.
 

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