Count function problem

Steve_God

Registered User.
Local time
Today, 22:08
Joined
Dec 3, 2002
Messages
17
Hi,

I have a simple 1 table database about 'Care Services'.
Each entry has contact details, etc.. and an option of lots of different categories it could come under, and they can come under as many categories as they want to - These are done as Yes/No boxes.

Each search for a type of Service is done with it's own individual query and report based on looking up the main table and looking for entries with 'Yes' under that category.
On a form I have a button for each category which opens it's own query.

My problem is that on this form I would like unbound text boxes that display the number of entries for each category that updates itself everytime that form is loaded.
I have tried using funtions that work in Reports, such as:
=Count([Service]![Funding])

(Nb. I have the source for the form set as 'Service' table.)

However this counts ALL records in the Service table, instead of just the ones that are ticked (Yes) to that category. (In this case 'Funding').


Could anyone help me please as I need this for work? thanks :)

- Steven Garratt
 
If you are doing this on a form:


Set your text box to:
=DCount("YesNoField","SourceTable","YesNoField = True")


(Obviously replace the field & table names)
 
Count(IIf(
!TICKED=True and ([Service]![Funding] '"Whatever" ,1))
 
=DCount("YesNoField","SourceTable","YesNoField = True")

^^ that one worked great!

Thanks again! :)
 
Compliments to you Steve.

Being a regular "Searcher" for forum answers, rather than just re-posting, I find it all too frustrating when a user has received a positive outcome, but never bothered to inform the forum as to the final solution.

I hate reading through a 3 page thread only to have the final post read:
"Thanks for the help - But I found another solution." (END OF THREAD).

Now if anyone reads your thread, they will at least know what worked.

Regards
Brad.
 

Users who are viewing this thread

Back
Top Bottom