How to Give more than one Not Equals to Operator in a Report? (1 Viewer)

JithuAccess

Member
Local time
Today, 10:14
Joined
Mar 3, 2020
Messages
297
Hello Guys,

I want to find the Sum of the Payment if the Program is Not Equals to "M" Or "H" and I have given this Code

Code:
=Nz(DSum("[curTotal Paid]","[tblPayments Final]","strProgram<>'M' Or 'H'),0)

But I am getting an Incorrect Result.

I think the Logic is wrong.

Could you guys please help me how to fix this?

Thanks
 

The_Doc_Man

Immoderate Moderator
Staff member
Local time
Today, 11:14
Joined
Feb 28, 2001
Messages
27,150
Code:
=Nz(DSum("[curTotal Paid]","[tblPayments Final]","strProgram<>'M' Or strProgram <> 'H'),0)

The problem is that the ENGLISH word OR doesn't have the same exact meaning as the COMPUTER operator-symbol OR.

In English, OR is a conjunction. In Computerese, OR is an action verb.
 

JithuAccess

Member
Local time
Today, 10:14
Joined
Mar 3, 2020
Messages
297
Code:
=Nz(DSum("[curTotal Paid]","[tblPayments Final]","strProgram<>'M' Or strProgram <> 'H'),0)

The problem is that the ENGLISH word OR doesn't have the same exact meaning as the COMPUTER operator-symbol OR.

In English, OR is a conjunction. In Computerese, OR is an action verb.
Thanks a lot. I fixed it. I used "Is Null" and it worked Perfect. In my Programs Fields there are 3 Values "M", "H" and Blank (Null) I want to find the total of Blank (Null) and I use this code:
Code:
=Nz(DSum("[curTotal Paid]","[tblPayments Final]","strProgram Is Null),0)


Thank You
 

theDBguy

I’m here to help
Staff member
Local time
Today, 09:14
Joined
Oct 29, 2018
Messages
21,457
Code:
=Nz(DSum("[curTotal Paid]","[tblPayments Final]","strProgram<>'M' Or strProgram <> 'H'),0)

The problem is that the ENGLISH word OR doesn't have the same exact meaning as the COMPUTER operator-symbol OR.

In English, OR is a conjunction. In Computerese, OR is an action verb.
Pardon me for jumping in, but just to clarify for future readers, using OR would sum all the records because M<>H and vice versa.

In this case, I think we would want to use the AND operator.
 

The_Doc_Man

Immoderate Moderator
Staff member
Local time
Today, 11:14
Joined
Feb 28, 2001
Messages
27,150
Good point, tDBg, that's what I get for shooting from the hip.
 

Gasman

Enthusiastic Amateur
Local time
Today, 17:14
Joined
Sep 21, 2011
Messages
14,239
Missing " from end of criteria, so how did that work?
 

Users who are viewing this thread

Top Bottom