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

Problem with selection criteria not working

Status
Not open for further replies.

mellicks

Programmer
Aug 27, 2008
11
US
I hope someone can help me on this. I've been staring at it until I'm cross-eyed. I am trying to pull information from a database in such a way that either all fields have information in them OR the first three fields are blank, but the rest are filled in. My selection criteria is shown below, but the report is pulling for only the first set of the criteria, nothing after the OR is working and I can't figure out why. There is other selection criteria besides this section, so I put this section in () so it's evaluated together. Any help would be GREATLY appreciated!

Code:
((({ActivityIndicator.Number}=1 and
{ActivityIndicator.Category}=11 and
{ActivityIndicator.Classification}=1) and

({PayCodeIndicator.Number}=5 and
{PayCodeIndicator.Category}=11 and
{PayCodeIndicator.Classification}=1) and

({PayCodeIndicator_1.Classification}=1 and
{PayCodeIndicator_1.Category}=3 and
{PayCodeIndicator_1.Number}=1) )  

OR

((isnull({ActivityIndicator.Number}) and
isnull({ActivityIndicator.Category}) and
isnull({ActivityIndicator.Classification}))and

({PayCodeIndicator.Number}=5 and
{PayCodeIndicator.Category}=11 and
{PayCodeIndicator.Classification}=1) and

({PayCodeIndicator_1.Classification}=1 and
{PayCodeIndicator_1.Category}=3 and
{PayCodeIndicator_1.Number}=1) )
)

Thanks so much for looking! [hourglass]
 
(
(
(
isnull({ActivityIndicator.Number}) and
isnull({ActivityIndicator.Category}) and
isnull({ActivityIndicator.Classification})
)and
(
{PayCodeIndicator.Number}=5 and
{PayCodeIndicator.Category}=11 and
{PayCodeIndicator.Classification}=1
) and
(
{PayCodeIndicator_1.Classification}=1 and
{PayCodeIndicator_1.Category}=3 and
{PayCodeIndicator_1.Number}=1)
)
) or
(
(
{ActivityIndicator.Number}=1 and
{ActivityIndicator.Category}=11 and
{ActivityIndicator.Classification}=1
) and
(
{PayCodeIndicator.Number}=5 and
{PayCodeIndicator.Category}=11 and
{PayCodeIndicator.Classification}=1
) and
(
{PayCodeIndicator_1.Classification}=1 and
{PayCodeIndicator_1.Category}=3 and
{PayCodeIndicator_1.Number}=1
)
)
)

You must check for nulls first--otherwise, once a field is referenced it is treated as if it is non-null.

-LB
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top