Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Field validation on a form.

Status
Not open for further replies.

ddmtn546

Technical User
Dec 20, 2000
38
US
What is the best way to require a user to enter a value, or not null? Is it best done at the table or form level? Thanks in advance.
 
Definitely at the table level...in the validation rules. That way all data is controlled from the ground up.

In the validation rules for whatever field your interested in, just type Is Not Null. You can also select required to "yes".

Either of these should take care of it for you.

-Patrick

Nine times out of ten, the simplest solution is the best one.
 
However...make sure that you set a message in either the table (Validation Text) or in the form utilizing a module or the user could get a Default confusing message in Access.


"I know what you're t'inkin', ma petite. Dat Gambit... still de suave one, no?"
 
I have entered the suggested "Is Not Null" & set required to "Yes" & entered a validation text. When I bring up the table in edit mode, I can tab and/or arrow through and past the field set up above seemingly without burp from the system. Am I missing something? Thanks.
 
You will be able to tab through it...but what happens when you try to move to a new record?

Also...get rid of Is Not Null in the Validation rule...you only need YES in required.

Jeff


"I know what you're t'inkin', ma petite. Dat Gambit... still de suave one, no?"
 
Jeff's right...when you goto to a new record with a field that is required that has a null value, you'll get an error, and it won't let you save the record. Good tip on the validation text too, Jeff!

-Patrick

Nine times out of ten, the simplest solution is the best one.
 
Both you guys are right. Thanks. Is there a less criptic way to display the error message? Thanks.
 
In design mode of your table, just enter whatever you want to tell the user when they make a mistake into the Validation Text property, such as:

"Hey Dummy...you can't leave that field blank"

Then, if there's a null value, that message will pop up in a message box.

Glad it's working now!

-Patrick

Nine times out of ten, the simplest solution is the best one.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top