Req: Count of Two Columns

K

kenneth_lad

hi all,

can anyone tell me how to create a query that counts two columns in across
two tables that i have?

i know how to count individual columns but i seem to have a problem
counting the total of both columns.

the information is to help me with an upcoming event that i am staging for
out members. one table lists all of our members and the column that i want
the count has a "Yes" in it if the member is attending.

in a second table i have a member guest join which lists the names of the
guests each member is bringing.

therefore i want to be able to count the total number of people attending
(members and their guests).

thanks to anyone who can help
 
A

Allen Browne

Try this:

=Abs(DSum("IsAttending", "MemberTable") + DCount("*", "GuestTable")

Internally, Access uses -1 for Yes and 0 for No. Therefore summing your
yes/no field gives a count of the number of yeses (but negative).

DCount() gives the count of records. Counting everything (the "*") is the
fastest result.
 
K

kenneth_lad

Try this:

=Abs(DSum("IsAttending", "MemberTable") + DCount("*", "GuestTable")

Internally, Access uses -1 for Yes and 0 for No. Therefore summing your
yes/no field gives a count of the number of yeses (but negative).

DCount() gives the count of records. Counting everything (the "*") is the
fastest result.

Thank you!
 

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