Reserved Error (-3087)

JithuAccess

Member
Local time
Today, 05:03
Joined
Mar 3, 2020
Messages
325
Hello Guys,

I am getting following Error Message when I am trying to Run the Report.

1618430086771.png




This is the Code:

Code:
=Count(IIf([strProgram]="Primary" And [datApplication Date] Between Date() And Date()-7,1))

Here I am giving two criteria. It is working fine when I am giving just 1 criteria (either datApplication Date or strProgram).

Could you please let me know what's the Error.

Thanks
 
I think you're missing the False part of your IIf() expression. However, I would probably use Sum() instead of Count().
 
I think you're missing the False part of your IIf() expression. However, I would probably use Sum() instead of Count().
I tried both Count and sum.

Thanks
 
Yes

This is what I gave:

Code:
=Sum(IIf([strProgram]="Primary" And [datApplication Date] Between Date() And Date()-7,0))
Hi. Sorry to tell you this, but that expression doesn't have a False part either. The proper syntax for an IIf() expression goes like this:
Code:
IIf(condition, true part, false part)
Your expression only has this:
Code:
IIf(condition, true part)
 
Hi. Sorry to tell you this, but that expression doesn't have a False part either. The proper syntax for an IIf() expression goes like this:
Code:
IIf(condition, true part, false part)
Your expression only has this:
Code:
IIf(condition, true part)

Sorry. But there were 4 other Reports and this Function is working fine in all these Reports with this Syntax

Code:
=Count(IIf([strProgram]="Primary" And [strNew or Additional Information]="New" And [datReceived Date] Between Date() And Date()-7,1))
 
Sorry. But there were 4 other Reports and this Function is working fine in all these Reports with this Syntax

Code:
=Count(IIf([strProgram]="Primary" And [strNew or Additional Information]="New" And [datReceived Date] Between Date() And Date()-7,1))
Hey, it may work or it may not, it's good if it works for you, but that wasn't my point. If you don't use the proper syntax, the result you're getting may be accurate or invalid. You're taking an unnecessary risk, in my humble opinion. If you use the proper syntax, then it should just work, and the result should always be accurate. No second guessing required. Just my 2 cents...
 
Hey, it may work or it may not, it's good if it works for you, but that wasn't my point. If you don't use the proper syntax, the result you're getting may be accurate or invalid. You're taking an unnecessary risk, in my humble opinion. If you use the proper syntax, then it should just work, and the result should always be accurate. No second guessing required. Just my 2 cents...
Thanks a lot for your suggestion Sir. Let me find the correct Syntax. Thanks a lot for your Effort and Time.
 
I gave you the correct syntax earlier. Just need to replace each part with your objects. Let us know if you need help with that.

This is my Code

Code:
=Count(IIf([strProgram]="Primary" And [datApplication Date] Between Date() And Date()-7,1,0))

"1" is True Part and "0" False Part. But unfortunately I am getting same Error message

Thanks
 
This is my Code

Code:
=Count(IIf([strProgram]="Primary" And [datApplication Date] Between Date() And Date()-7,1,0))

"1" is True Part and "0" False Part. But unfortunately I am getting same Error message

Thanks
Do you get the same error with this one?
Code:
=Sum(IIf([strProgram]="Primary" And [datApplication Date] Between Date()-7 And Date(),1,0))
 
Okay, does the error go away with this?
Code:
=IIf([strProgram]="Primary" And [datApplication Date] Between Date()-7 And Date(),1,0)
Yes. But there are 2 Records and in this Report the Count is showing as just 1.

Thanks a lot for your Help
 
Yes. But there are 2 Records and in this Report the Count is showing as just 1.

Thanks a lot for your Help
Hi. Glad to hear you got it working. If you're trying to count records based on certain conditions, I recommend using the Sum() function, rather than the Count() function. You could use Count() if you just want to count all records, without any criteria.
 
Hi. Glad to hear you got it working. If you're trying to count records based on certain conditions, I recommend using the Sum() function, rather than the Count() function. You could use Count() if you just want to count all records, without any criteria.

Thanks a lot. But when I am giving Sum() or Count() I am getting the Error and if I am using =iif it is just showing Record count as 1 (True Value Part).

Could you please let me know how to crack this.

Thanks
 
Thanks a lot. But when I am giving Sum() or Count() I am getting the Error and if I am using =iif it is just showing Record count as 1 (True Value Part).

Could you please let me know how to crack this.

Thanks
I think you cannot use Sum() or Count() against Textbox Controls. Are [strProgram] and [datApplication Date] the names of fields in your table?
 

Users who are viewing this thread

Back
Top Bottom