Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Error #Name for source code

Status
Not open for further replies.

teqtaq

Technical User
Nov 18, 2007
197
US
I am having Report based on query.
I need to have summary and I am trying to insert text box where data source looks like following:

=(Select Count([Table1].[EMPLID]FROM TABLE1 WHERE [Table1].[COUNTRY]='FR')

I am placing this in the group footer and it gives me the #Name error.

Can you see why? Thanks
 
You have inconsistent parenthesees
Code:
=(Select Count([Table1].[EMPLID][red])[/red] FROM TABLE1 WHERE [Table1].[COUNTRY]='FR')
I'd also put in a space before the FROM keyword.

Hope this helps

HarleyQuinn
---------------------------------
The most overlooked advantage to owning a computer is that if they foul up there's no law against wacking them around a little. - Joe Martin

Get the most out of Tek-Tips, read FAQ222-2244 before posting.

 
Sorry, it does the same still...
 
You can't use a SQL statement as the Control Source of a text box. Either use a subreport to display the value or try:
Code:
 =DCount("[EMPLID]","TABLE1","[COUNTRY]='FR'")


Duane
Hook'D on Access
MS Access MVP
 
It works except it does not care where it placed. It gives me Grand Total and I am looking for Total per Group.

Thanks, I will use it for Grand Totals.
I am wondering if there is a way to let it know - 'we are in Group'? :))
 
Use a subreport and link master/child on the "GROUP". Or tell us something about the "group"? I expect there is a field name and data type that we don't know about. Does table1 contain the field group?

I would probably create a totals query like:
Code:
  SELECT [GroupField], Count(Emplid) as EmpCount
  FROM Table1
  WHERE Country = "FR"
  GROUP BY [GroupField];
Then add this query to your report's record source query and join the [GroupField]s. Then rather than using DCount() or any other expression, just use a text box bound to EmpCount.

FROM

Duane
Hook'D on Access
MS Access MVP
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top