View Full Version : Table Validation Rule doesn't work...


zestygirl
01-28-2005, 10:28 AM
Hello, all.

I have a table that contains a field (list) for categories [Inquiry Type], and a field that tracks category of any follow-ups [FU Inquiry Type].

The rule is: If [Inquiry Type]="F", than [FU Inquiry Type] Is not null.

For some reason, when I'm entering data, the validation rule does not take any effect....does not notice when [FU Inquiry Type] - which is also a list box - remains empty when [Inquiry Type] is an F.

I have entered the rule this way in the table property validation rule field:

(([Inquiry Type]="F" AND [FU Inquiry Type] Is Not Null) OR ([FU Inquiry Type] Is Null)

I already have data in this table, but have ensured that it conforms to the above rule. Can anyone help?

Rich
01-28-2005, 03:39 PM
I'm sure that you have to carry out this type of validation at Form, not table level.
You would need to use the forms Before Update event to trap this.

Pat Hartman
01-28-2005, 05:11 PM
Form level validation rules cannot be based on other columns.

Put your validation code in the BeforeUpdate event of the FORM and cancel the event it an error is found.

zestygirl
01-31-2005, 06:40 AM
Thanks, guys - I actually figured out how to make this work without a form....and Pat, although you are correct that you may not reference more than one field in a field validation - you are free to do so in the table validation. I wrote the validation like this - which means:

if column A = X, than column B Is not null, or, If column A = anything other than X, column B Is Null.

To enter a Table Validation rule, enter the design view, than View Properties....

(([Inquiry Type]="F" AND [FU Inquiry Type] Is Not Null) Or ([Inquiry Type] <>"F" AND [FU Inquiry Type] Is Null))

Hope someone finds this useful....took me an hour to figure out!!!