#Error (1 Viewer)

JithuAccess

Member
Local time
Today, 15:40
Joined
Mar 3, 2020
Messages
297
Hello Guys,

In my Report I am using DCount Function to find the Total Number of Decisions made in a Month by Program and this is my code

Code:
=DCount("strProgram","[tblMaster Table]","strProgram='ABC-123' And datDecision Between DateSerial(Year(Date()),Month(Date())-1,1) And DateSerial(Year(Date()),Month(Date())+0,0)")
This is working Perfect.

But I also have to find the total number of Decision by Fiscal Year. So I have add the following code:

Code:
=DCount("strProgram","[tblMaster Table]","strProgram='ABC-123' And datDecision Between DateSerial(Year(Date())-1,4,1) And DateSerial(Year(Date())+0,3,31),1)")
I am getting #Error in the Report.

Could you please let me know how to fix this?

Thanks
 

The_Doc_Man

Immoderate Moderator
Staff member
Local time
Today, 16:40
Joined
Feb 28, 2001
Messages
27,001
Check your parentheses in the 2nd statement for the 2nd DateSerial. I think you have unbalanced parentheses. I counted more ")" than "("
 

JithuAccess

Member
Local time
Today, 15:40
Joined
Mar 3, 2020
Messages
297
Check your parentheses in the 2nd statement for the 2nd DateSerial. I think you have unbalanced parentheses. I counted more ")" than "("
Thanks a lot for your Reply. I have changed my code to:

Code:
=DCount("strProgram","[tblMaster Table]","strProgram='ABC-123' And datDecision Between DateSerial(Year(Date())-1,4,1) And DateSerial(Year(Date())+0,3,31),1")

But still getting same #Error

Thanks
 

The_Doc_Man

Immoderate Moderator
Staff member
Local time
Today, 16:40
Joined
Feb 28, 2001
Messages
27,001
I do not see the meaning of what I have highlighted in RED.

DateSerial(Year(Date())+0,3,31),1"

Your DCOUNT is complete without that part and I don't see anything that relates to that as an alternate argument. I.e. it appears to be "dangling syntax" unrelated to anything else in the line. Did you perhaps copy something and forget to edit out the part you didn't want?
 

JithuAccess

Member
Local time
Today, 15:40
Joined
Mar 3, 2020
Messages
297
Thanks a lot. Sorry for copying and pasting Codes without really understanding what that codes meant for. I have changed my code:

Code:
=DCount("strProgram","[tblMaster Table]","strProgram='ABC-123' And datDecision Between DateSerial(Year(Date())-1,4,1) And DateSerial(Year(Date())+0,3,31)")

And this is working Perfect.

Thanks a lot for your Help
I do not see the meaning of what I have highlighted in RED.

DateSerial(Year(Date())+0,3,31),1"

Your DCOUNT is complete without that part and I don't see anything that relates to that as an alternate argument. I.e. it appears to be "dangling syntax" unrelated to anything else in the line. Did you perhaps copy something and forget to edit out the part you didn't want?
 

Users who are viewing this thread

Top Bottom