Full Version: Error Using Function In Report Text Box
UtterAccess Forums > Microsoft® Access > Access Reports
I have a text box in a report header. I want to display the result of a function, ecount by allen browne, in the text box. I have it working on several reports, but for some reason I'm getting various error messages in this one.
The arguments for ECount are:
Public Function ECount(Expr As String, Domain As String, Optional Criteria As String, Optional bCountDistinct As Boolean) As Variant

I'm trying to display the number of unique studentids in the query 'qrysrptEmplDuring_SSR'. I've tried the following two setups, but while they work perfectly in the
immediate window they generate the following errors when i try to use them in the textbox.
'invalid syntax: you may have entered a comma without a preceding value or identifier
i'm guessing the error is because of the back to back commas? so i tried it by just telling the code what bCountDistinct I wanted:
'error: you may have entered an operand without an operator
Grr. I've tried web searching, but so far with no luck. Any idea what is going wrong?
I posted something, but the more I read your post... the more I think I have no idea what you're doing. Maybe someone else has an idea...
Hi Becca
ew thoughts
What event triggers the call to "ECount"?, is this the same as your other reports trigger event?
Are there any criteria in "qrysrptEmplDuring_SSR" that are not valid when you open this particular report?
Hi Pere and Brian!
Thanks for the replies!
What I'm doing is not very complicated, I'm probably just doing a bad job explaining.
For the event trigger, yes, it is the same as the other reports. The call to ECount is done when the report formats (I think.. not sure exactly)
There is another call to Ecount in the same section of the same report, and works just fine:
The only difference between this ECount and the second one is that in the second one I want to only count the unique StudentIDs.
The way the function ECount works, that means when I call ECount I need to set bCountDistinct to True when I call ECount. But I can't find a way to do that which is syntactically agreeable to Access. As soon as I type the function in the textbox and try to move my cursor out of the textbox I get the errors I mentioned.
Does that help?
Hi Becca
IT WORKS!! Perfect! Thank you!!!!
Good luck with your project.
This is a "lo-fi" version of UA. To view the full version with more information, formatting and images, please click here.