Counting True items

hooby1

Registered User.
Local time
Today, 08:50
Joined
May 9, 2004
Messages
48
Can anyone help?
I have a table with the following:
Booked with a y/n field
Person Name with a text field
So...
Yes(True) Jim
Yes(True) Jim
No(False) Jim

What I need is to be able to show a query that shows if the checkbox is ticked (True) and the Name is Jim total up how many true items there are. So from the above I can see that Jim has 2 true items. I would then like this shown in a text box is this possible?
Also, it is not always going to be a person called Jim so... (From above)
Yes(True) Jim
Yes(True) Jim
No(False) Jim
Yes(True) Jack

So how would this go on a query in a sub form? So Name Jim would show 2 and Jack would show 1? At the moment is is grouping the name and I dont want that.
Any ideas
Cheers
 
The query:-
SELECT [Person Name], -Sum([Booked]) AS [Count]
FROM [TableName]
GROUP BY [Person Name];
.
 
Cheers for the reply. Is that the same in 97? When doing the query it then prompts for a name and a true option. How does this then go into a sub form?
Thanks
 
Since the internal value of a yes/no field is a -1 for true and a 0 for false, Jon's query should work in any version of Access.

You have to substitute with the exact field names and table name you are using.

Once the query works, you can create a subform based on the query.

^
 
Thanks for the help. Is it possible to put this result in a textbox? Would using DLookUp work? How would I go about doing this? Cheers
 

Users who are viewing this thread

Back
Top Bottom