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 Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Validation Rule to check on two fields 1

Status
Not open for further replies.

MCAUK

Technical User
Feb 22, 2005
6
GB
I have a table-level validation rule that looks like this:

IIf([status]=2,Not "isNULL [date completed]",[DATE COMPLETED]="")

[Status] is a field storing the result of an option group with three toggle buttons on the data entry form (Status 1 = 'Project In queue', Status 2= 'Project Completed', Status 3= 'Live Project').

The idea is that if the user selects status 2, they must enter a date in the filed named [date completed].

Can anyone help? I have desperately tried everything I can think of, though it displays the validation message in all cases that status 2 is selected, even if it's got a date in there already.

Cheers all,

MCAUK
 
Speaking as someone who would never even consider this type of validation, I guess it might be:

IIf([status]=2,isNULL([date completed])=false,isnull([DATE COMPLETED])=true)
 
Lupins46,

You're a GodSent. Your suggestion works perfectly. VERY VERY GRATEFUL INDEED.

Code:
IIf([status]=2,isNULL([date completed])=false,isnull([DATE COMPLETED])=true)

You let me thinking thogh, why would you never use this type of validation? Is it the wrong way of doing it?

Thansk a lot.

MCAUK
 
I would do all such validation in form event procedures.
That gives me the ability to test all sorts of conditions which you cannot implement collectively at table level.
 
Lupins46,

Thank you. I'll take thsi into account when i get to that stage. This is so far the only validation i need to incorporate, though it's likely that I may need to consider multiple validations and surely will posting questions here.

Thanks a lot.

MCAUK
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top