Counting Records

G

Guest

I have a query that pulls all counseling sessions during a set date range. There may be many counseling sessions for 1 client, so 1 client could be listed 3 times. I want the total clients counseled, so I need to get rid of the duplicates and only count each client once. Does anyone know how I could go about doing this? I'm not real familiar with coding, I can do some basic stuff, but I can play with codes to get them to work for me. Thanks for any help
Christina
 
J

Jeff Boyce

Christina

You didn't mention what your table structure was, so I'll have to assume you
have a way to uniquely identify the client in each of those sessions.

You can create a new query, add in your sessions table, set the date range
criteria (as parameters, if you wish), select the unique identifier, then
set the query property UniqueValues to Yes. You should get only one of
each.

Don't include any other fields that might hold differing values for the same
client (like date, or ...) -- those will cause each combination to be
considered for uniqueness, and your post said you only need to know who, not
how many...

Good luck

Jeff Boyce
<Access MVP>
 
Z

ZenoParadox

Look up the DCount() function. WAY easier, WAY more reliable.

YourRecordCount = DCount("*","your_fruity_table","fruit='bananas'")

would return the number of records in the table calle
"your_fruity_table" where the "fruit" field equalled "bananas"

:
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top