Validation rules Headache!!

Z

zestygirly

Hello, All;

Could one of the geniuses that seem so abundant in this forum PLEEZ help me?

I have a validation rule I cannot create, and I'm really no good when it
comes to VBA code...

Basically- I want it to do this:

IIf ([Fieldname]="X", Is not null, null). In other words - I only want to
have this filed filled in if another field in the same table is filled in as
an "X".
 
A

Allen Browne

Because you want to compare the value of another field, use the validation
rule for the table, not that of the field.

Open your table in design view.
Open the Properties box (View menu).
Enter a rule something like this:
(([Fieldname] = "X") AND ([ThisField] Is Not Null)) OR ([ThisField] Is
Null)
 
Z

zestygirly

Thanks Allen!

Well, that certainly helps...I have entered the code as shown in the
Validation Rule Field of the Table properties, but, it doesn't seem to be
working....still allows me to enter "X" in field1 without prompting that
field2 is a required entry in that case...

Allen Browne said:
Because you want to compare the value of another field, use the validation
rule for the table, not that of the field.

Open your table in design view.
Open the Properties box (View menu).
Enter a rule something like this:
(([Fieldname] = "X") AND ([ThisField] Is Not Null)) OR ([ThisField] Is
Null)

--
Allen Browne - Microsoft MVP. Perth, Western Australia.

Reply to group, rather than allenbrowne at mvps dot org.

zestygirly said:
Hello, All;

Could one of the geniuses that seem so abundant in this forum PLEEZ help
me?

I have a validation rule I cannot create, and I'm really no good when it
comes to VBA code...

Basically- I want it to do this:

IIf ([Fieldname]="X", Is not null, null). In other words - I only want to
have this filed filled in if another field in the same table is filled in
as
an "X".
 
A

Allen Browne

Okay. Try:
(([FieldName] <> "X") OR ([FieldName] Is Null)) OR

(([Fieldname] = "X") AND ([ThisField] Is Not Null))

That rule can be satisified 2 ways:
1) FieldName is anything except X (including Null);
2) FieldName is X, and the original field is not a blank.

That's what you're after?
--
Allen Browne - Microsoft MVP. Perth, Western Australia.

Reply to group, rather than allenbrowne at mvps dot org.

zestygirly said:
Thanks Allen!

Well, that certainly helps...I have entered the code as shown in the
Validation Rule Field of the Table properties, but, it doesn't seem to be
working....still allows me to enter "X" in field1 without prompting that
field2 is a required entry in that case...

Allen Browne said:
Because you want to compare the value of another field, use the
validation
rule for the table, not that of the field.

Open your table in design view.
Open the Properties box (View menu).
Enter a rule something like this:
(([Fieldname] = "X") AND ([ThisField] Is Not Null)) OR ([ThisField]
Is
Null)

--
Allen Browne - Microsoft MVP. Perth, Western Australia.

Reply to group, rather than allenbrowne at mvps dot org.

zestygirly said:
Hello, All;

Could one of the geniuses that seem so abundant in this forum PLEEZ
help
me?

I have a validation rule I cannot create, and I'm really no good when
it
comes to VBA code...

Basically- I want it to do this:

IIf ([Fieldname]="X", Is not null, null). In other words - I only want
to
have this filed filled in if another field in the same table is filled
in
as
an "X".
 
Top