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

Using "OR" to select data

Status
Not open for further replies.

mmck1964

Technical User
Jul 12, 2001
104
US
Below is the formula I have in the Record Selection Formula Editor based on a date range.

(({AP_VEND_PMT_ACT.AP_PMT_TYPE_CD} = "D") and ({AP_PMT_DTL_VIEW.AP_TRAN_TYPE_CD} = "I"))
or
((IsNull({AP_VEND_PMT_ACT.AP_PMT_TYPE_CD}) and ({AP_PMT_DTL_VIEW.AP_TRAN_TYPE_CD}) = "M"))

If I use either formula separately I get the correct data based on the formula. I am trying to use "OR to get both sets of data on one report. I am using a left outer join enforced from, but I have tried all combination too.

Please advise what I am doing wrong.

Thanks
 
Try reversing the order of these clauses:
((IsNull({AP_VEND_PMT_ACT.AP_PMT_TYPE_CD}) and ({AP_PMT_DTL_VIEW.AP_TRAN_TYPE_CD}) = "M"))
OR
(({AP_VEND_PMT_ACT.AP_PMT_TYPE_CD} = "D") and ({AP_PMT_DTL_VIEW.AP_TRAN_TYPE_CD} = "I"))

ISNULL must be the first check that you do.

Bob Suruncle
 
I did not know the ISNULL must be checked first, but that did not work. Is it because the AND statement is from two different tables?
 
((({AP_VEND_PMT_ACT.AP_PMT_TYPE_CD} = "D") and ({AP_PMT_DTL_VIEW.AP_TRAN_TYPE_CD} = "I"))
or
(IsNull({AP_VEND_PMT_ACT.AP_PMT_TYPE_CD}) and ({AP_PMT_DTL_VIEW.AP_TRAN_TYPE_CD}) = "M"))

It looks like parentheses enclose the second half of the OR statement twice, try moving the parenthesis to enclose the full statement?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top