Using IIF, does it have to be and/or?

  • Thread starter KFox via AccessMonster.com
  • Start date
K

KFox via AccessMonster.com

Here's what I have in a query thus far.

D: Sum(IIf([tblException]![DP Code]="D" Or [tblException]![RW Code]="D",
[tblException]![DP value]+[tblException]![RW Value],0))

The problem is I don't want to use OR nor does AND apply. I want the DP
Value and RW Value added together for those cases when the values in the Code
columns = "D". When I use OR, I find that it's adding more into the total
than it should.

Can I not use IIF in this scenario?

Thanks!
Kellie
 
D

Douglas J. Steele

Ignoring the fact that your table isn't properly normalized:

D: Sum(IIf([tblException]![DP Code]="D", [tblException]![DP value], 0) +
IIf([tblException]![RW Code]="D", [tblException]![RW Value],0))
 
K

KFox via AccessMonster.com

I haven't had a chance to give this a try yet, but could you explain what
"normalized" means?

Thanks!
Kellie
Ignoring the fact that your table isn't properly normalized:

D: Sum(IIf([tblException]![DP Code]="D", [tblException]![DP value], 0) +
IIf([tblException]![RW Code]="D", [tblException]![RW Value],0))
Here's what I have in a query thus far.
[quoted text clipped - 11 lines]
Thanks!
Kellie
 
D

Douglas J. Steele

Jeff Conrad has lots of good references about proper database design at
http://home.bendbroadband.com/conradsystems/accessjunkie/resources.html#DatabaseDesign101

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


KFox via AccessMonster.com said:
I haven't had a chance to give this a try yet, but could you explain what
"normalized" means?

Thanks!
Kellie
Ignoring the fact that your table isn't properly normalized:

D: Sum(IIf([tblException]![DP Code]="D", [tblException]![DP value], 0) +
IIf([tblException]![RW Code]="D", [tblException]![RW Value],0))
Here's what I have in a query thus far.
[quoted text clipped - 11 lines]
Thanks!
Kellie
 
Top