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!

COUNT(DISTINCT <expr>) is a report or its equivalent.

Status
Not open for further replies.

ThePixelMines

Technical User
Jun 6, 2007
17
US
This has been driving me crazy. It seems so simple.

I've got a class roster (report) that totals tuition, number of students per class and total students. I want a total of families. Right now, I have a table for families with a one-to-many relationship to a student table.

The result I'm looking for would be similar to that of
Code:
COUNT(DISTINCT [family_ID])
but that's not working in the report. I get a warning that I have an operand without an operator.

What am I missing here?



Check it, Fool!
 
There is no Count(distinct,...) in Access queries. If you want this, you may need to use a subquery or something. Since I expect your report is not sorted by family, you won't be able to use a running sum in the report.

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]
 
If you sort/group by Family then you can display the group header. Add a text box to the family header and set its properties:

Name: txtCountFamily
Control Source: =1
Running Sum: Over All
Visible: No

Then add a text box to the report footer:

Control Source: = txtCountFamily

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