DSum Function with 2 Criteria (1 Viewer)

JithuAccess

Member
Local time
Today, 05:53
Joined
Mar 3, 2020
Messages
297
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
 

theDBguy

I’m here to help
Staff member
Local time
Today, 04:53
Joined
Oct 29, 2018
Messages
21,467
Is strTransmission the name of your field, and it would literally have A:B as a value in it?
 

JithuAccess

Member
Local time
Today, 05:53
Joined
Mar 3, 2020
Messages
297
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
 

plog

Banishment Pending
Local time
Today, 06:53
Joined
May 11, 2011
Messages
11,643
Strings (strTransmission) don't lend themselves to being summed. Numbers usually fill that role.
 

JithuAccess

Member
Local time
Today, 05:53
Joined
Mar 3, 2020
Messages
297
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
 

Minty

AWF VIP
Local time
Today, 12:53
Joined
Jul 26, 2013
Messages
10,370
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
 

JithuAccess

Member
Local time
Today, 05:53
Joined
Mar 3, 2020
Messages
297
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

Top Bottom