Text Box Validation Rule Doesn't Quite Work

keyel1971

Registered User.
Local time
Today, 08:23
Joined
Sep 29, 2011
Messages
22
Hello,

I can't seem to find a solution to my problem. I have a text box on a form were the user inputs a date. If they skip this, then that's bad. So, in design view of the text box, I have set a validation rule of "Is Not Null", and validation text of "A date must be entered". It works fine, but ONLY if they enter something first.

In other words, the form opens and the field is blank. If they tab off the field, no message. But, if they enter somethign in the field and delete it and then tab off, they get the message.

How do I get the message to show if they tab off the field without entering anything first?

Thanks so much - I'm just learning!
 
You use Is Null

But what if they want to cancel entering that record, what will happen?
 
Is Null allows me to tab off the field without entering anything. In addition, when I do enter something and tab off, I get the validation text. So it seems is not null works better - it does everything right, but will allow you to tab off if you don't enter somethign first.
 
If it doesn't work then your field is not Null.

In the field's properties (i.e. table level), is the Allow Zero-Length String property set to Yes?
 
The field is a text box on a form though - no table (that I know of).
 
What is in the Record Source property of your form?
 
Alright, so it's an unbound form. Try this validation:

Len([TextboxName] & "") = 0

The thing is most of us don't use Validation because it's limited but since you're a beginner it might be worth learning.
 
Thanks. No, that didn't seem to work. However, I came up with a macro - IsNull([Forms]![FormMaster]![RepMo]) that displays a message when that field is skipped.
 
Yes, I have it as a conditional macro. The form opens with the cursor in the date field. When the focus moves off that field, the macro runs and pops up a message. Now I'm trying to get it so that when they click OK on the message, it brings them back to the field they need to enter (i.e., won't let them move forward until they complete the field).
 

Users who are viewing this thread

Back
Top Bottom