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

Counting Unique Field

Status
Not open for further replies.

megmem

Instructor
Jun 20, 2002
11
US
Hi,

I have a report that lists Mailers, and i would like to count the unique mailers. For Example,

Mailer

Mark
Mark
Tom

Total number of mailers = 2, is there a formula that can count in this fashion. Thanks in advance
 
Try this in a query, of course changing to your table and field names:
Code:
SELECT Count(YourTable.Mailer) AS CountOfMailer, YourTable.Mailer
FROM YourTable
GROUP BY YourTable.Mailer;
 
Thanks for your help, but i have another question for you, maybe we can implement your formula in this function. I have a tabe that lists Mailer, and Runtype, I would like to count the unique mailers, that have the Run Type CD, LR, and RU.

I used the following Formula =Dcount("[Mailer]","Daily Reports","[Run Type]='CD'")+=Dcount("[Mailer]","Daily Reports","[Run Type]='LR'")+=Dcount("[Mailer]","Daily Reports","[Run Type]='RU'")

I believe this formula will count all of the mailers for the specific Run Type. I will like to incorporate your formula so i can group the mailer, and get the count i am looking for. Is it possible? Thanks in advance

 
Try:

SELECT Count(YourTable.Mailer) AS CountOfMailer, YourTable.Mailer
FROM YourTable
GROUP BY YourTable.Mailer
HAVING (((YourTable.[Run Type]) In ("CD", "LR", "RU")));
 
Hi,

Thanks for yout help, but i am getting an name error.

I posted the formula again, maybe i am missing a comma or somthing

When you get a chance, take a look at it for me. Also i am typing this code in the control source of a textbox, is that correct? Thanks

SELECT Count(QGPL_ORDERLOG.EUS) AS CountOfEUS, YourQGPL_ORDERLOG.EUS
FROM QGPL_ORDERLOG
GROUP BY QGPL_ORDERLOG.EUS
HAVING (((QGPL.ORDERLOG.[OTYP]) In ("CD", "LR", "RU")));
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top