Making a simple yes count! (1 Viewer)

Krays23

Registered User.
Local time
Today, 07:51
Joined
Jun 18, 2015
Messages
46
Guys

im having a moment here

I have a query which looks at various parts in production areas

I have a check box that's returning yes there is a part ther or no there isn't

all I want to do is count the yes ! surely im missing something here

PLease help

Dan
 

Ranman256

Well-known member
Local time
Yesterday, 23:51
Joined
Apr 9, 2015
Messages
4,339
since YES is actually -1, you can just sum the absolute value: Sum( ABS([field]))
or
count([field]) where [field] = true
 

Krays23

Registered User.
Local time
Today, 07:51
Joined
Jun 18, 2015
Messages
46
since YES is actually -1, you can just sum the absolute value: Sum( ABS([field]))
or
count([field]) where [field] = true

I have 15 different fields I want to count each field

one field is called [Part In Lay Up] where do I put it in criteria?

it says invalid syntax
 

Ranman256

Well-known member
Local time
Yesterday, 23:51
Joined
Apr 9, 2015
Messages
4,339
then your table layout is wrong. Access counts down in a field, not across table fields.

But you can still count them, I suggest a union query
select "part In LayUp" as lbl, sum(Abs([Part In Lay Up])) from table
union
select 'Is Smoker' as lbl, sum(Abs([smoker])) from table
union
etc
 

Krays23

Registered User.
Local time
Today, 07:51
Joined
Jun 18, 2015
Messages
46
Thanks got it counting the fields but in negative any way to flip that when I make it a graph as I actually have positive parts not negative?
 

The_Doc_Man

Immoderate Moderator
Staff member
Local time
Yesterday, 22:51
Joined
Feb 28, 2001
Messages
27,140
If worst comes to worst, write a query.

In any field where you have one of these in the raw table, use

IIF( Nz([Y/N field name], False), 1, 0 )

Then you can do a DCOUNT of that field in a second query. The NZ protects against damaged records or nulls, and the IIF returns one of two values based on True/False state of the first argument of the IIF.
 

Krays23

Registered User.
Local time
Today, 07:51
Joined
Jun 18, 2015
Messages
46
If worst comes to worst, write a query.

In any field where you have one of these in the raw table, use

IIF( Nz([Y/N field name], False), 1, 0 )

Then you can do a DCOUNT of that field in a second query. The NZ protects against damaged records or nulls, and the IIF returns one of two values based on True/False state of the first argument of the IIF.

I cant get it to work

I have 16 fields all I want to do is count the rows that say yes in each field and make a graph off it in positives not negatives
 

Krays23

Registered User.
Local time
Today, 07:51
Joined
Jun 18, 2015
Messages
46
I cant get it to work

I have 16 fields all I want to do is count the rows that say yes in each field and make a graph off it in positives not negatives

I can build a query and see the data I want but ill be dammed if I can show it on graph
 

Users who are viewing this thread

Top Bottom