DSum Function with 2 Criteria

JithuAccess

Member
Local time
Yesterday, 17:27
Joined
Mar 3, 2020
Messages
325
Hello Guys,

I was trying to find the Total count of Records based on 2 criteria in my Report. This is my Code:

Code:
=DSum("[strTransmission]","[Table1]","strTransmission='A:B' And [datPayment Date] Between #2020-04-01# And #2020-04-30#")

But I am getting #Error

Could you please let me know how to fix this?

Thanks
 
Is strTransmission the name of your field, and it would literally have A:B as a value in it?
 
Is strTransmission the name of your field, and it would literally have A:B as a value in it?
Yes [strTransmission] is the name of my Field and there are 2 Records A:B between 2020-04-01 and 2020-04-30.

Thanks
 
Strings (strTransmission) don't lend themselves to being summed. Numbers usually fill that role.
 
Strings (strTransmission) don't lend themselves to being summed. Numbers usually fill that role.
I have changed my Code like:

Code:
=DCount("[strTransmission]","[Table1]","[strTransmission]='A:B' And [datPayment Date] Between '#2020-04-01#' And '#2020-04-30#'")

But still getting same #Error in my Report.

Thanks
 
You have put ' ' delimiter around your dates. The dates delimiters are the # # .

Code:
=DCount("strTransmission","Table1","[strTransmission]='A:B' And [datPayment Date] Between #2020-04-01# And #2020-04-30#")
N
Note that the [ ] around the table name and field name are unnecessary when there aren't spaces in the names and they aren't reserved words.

Another bonus of a good naming convention
 
You have put ' ' delimiter around your dates. The dates delimiters are the # # .

Code:
=DCount("strTransmission","Table1","[strTransmission]='A:B' And [datPayment Date] Between #2020-04-01# And #2020-04-30#")
N
Note that the [ ] around the table name and field name are unnecessary when there aren't spaces in the names and they aren't reserved words.

Another bonus of a good naming convention
Many Thanks. This worked Perfect
 

Users who are viewing this thread

Back
Top Bottom