SQL string as "Control Source" for a text box...

  • Thread starter Thread starter ScottS
  • Start date Start date
S

ScottS

I'm trying to calculate the MODE in a report.
When I enter the following SQL string in the text
boxes "control source" property:

= SELECT TOP 1 [tblMngrSurvey].[bytStaff] FROM
[tblMngrSurvey] GROUP BY [tblMngrSurvey].[bytStaff] ORDER
BY COUNT([tblMngrSurvey].[bytStaff]) DESC;

I get an error about needing parenthesis around the
subquery.
???
HELP!
Thank you for your time and interest,
Scott
Fuquay-Varina, North Carolina
 
Scott

I suspect you need to add parentheses around your subquery...

Your SQL is ORDER-ing BY an expression, not a field. That expression is
probably the subquery referred to. My SQL is rusty, so I'm not sure on
this, but the COUNT expression doesn't look like a complete query (which it
would have to be to be a subquery).

Can you run a query that only says

COUNT([tblMngrSurvey].[bytStaff])

and get a result?

Good luck

Jeff Boyce
<Access MVP>
 
Back
Top