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 Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

defect of access query affect the report

Status
Not open for further replies.

maswien

Technical User
Sep 24, 2003
1,286
CA

Access doesn't support function count(distinct ...), for some report this function is very useful, how the access report programmer work around this issue?
 

Without this function, I doubt that access is a good report tool.
 
I wrote a query in Oracle SQL that did the same in Oracle as a select count(distinct .. and then used the alternate form Oracle in Access.

Code:
SELECT Count(*) AS Expr1
FROM (select distinct subinfo3 from query3) AS Q1;
Which worked.

This is what the query builder in Access translated my SQL to:
Code:
SELECT Count(*) AS Expr1
FROM [select distinct subinfo3 from query3]. AS Q1

Learn something new every day I guess.
 
If you create a report with a grouping on the field you would count distinct...
Add a text box to the field's group header:
Name: txtCountDistinct
Control Source: =1
Running Sum: Over All
Add a text box to the Report Footer section:
Control Source: =txtCountDistinct

Why would you blame this issue on the report rather than JET SQL syntax?

Duane MS Access MVP
[green]Ask a great question, get a great answer.[/green] [red]Ask a vague question, get a vague answer.[/red]
[green]Find out how to get great answers faq219-2884.[/green]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top