Checkbox Totals, how to? (1 Viewer)

Jaydub1991

New member
Local time
Today, 17:13
Joined
Sep 21, 2021
Messages
10
Morning all,

My Data base is comprised of Tables which is organised by "Clients" and within these fields is a checkbox column. I am looking to calculate all the ticked boxes for each client.
Clients are separated by a GroupID but all reside in one Table. very basic view of it below ( there are more fields but they are irrelevant)


GroupIDCustomer NameFile Closed
Client 1SmithTickbox
Client 2JonesTickbox
Client 1BobTickbox
Client 3DaviesTickbox
Client 2AlbertTickbox
Client 3PetersTickbox


I would like the total for each Clients tickboxes displayed on a seperate form which makes up part of the menu for my database.

I am very very very basic with Access Databases and had the assistance of another to put this database together so please go easy on me!

Ta

James
 

arnelgp

..forever waiting... waiting for jellybean!
Local time
Tomorrow, 00:13
Joined
May 7, 2009
Messages
19,246
create a Total query.
see query1.
 

Attachments

  • ClientCheckbox.accdb
    436 KB · Views: 93

CJ_London

Super Moderator
Staff member
Local time
Today, 17:13
Joined
Feb 19, 2013
Messages
16,662
tickboxes contain one of two values, -1 for true/ticked and 0 for not ticked

so you simply need an aggregate query

Code:
SELECT GROUPID, -sum(FileClosed) as numColsed
FROM myTable
GROUP BY GROUPID
 

Jaydub1991

New member
Local time
Today, 17:13
Joined
Sep 21, 2021
Messages
10
Ok so sorry to confuse things, Thank you for you assistance to get me the number of Job closed, but how would I change this to show the Remaining open jobs?
 

cheekybuddha

AWF VIP
Local time
Today, 17:13
Joined
Jul 21, 2014
Messages
2,320
SQL:
SELECT
  GROUPID,
  -SUM(FileClosed) AS numClosed,
  SUM(IIf(FileClosed = False, 1, 0)) AS numOpen
FROM myTable
GROUP BY
  GROUPID
;
 

arnelgp

..forever waiting... waiting for jellybean!
Local time
Tomorrow, 00:13
Joined
May 7, 2009
Messages
19,246
Code:
SELECT
    yourTable.GroupID,
    Sum([File Closed]*-1) AS [Total File Closed],
    Sum([File Closed]+1) AS [Total File Open]
FROM yourTable
GROUP BY yourTable.GroupID;
 

Attachments

  • ClientCheckbox.accdb
    436 KB · Views: 84

Jaydub1991

New member
Local time
Today, 17:13
Joined
Sep 21, 2021
Messages
10
I have used the Query Method but i can only get it to show the total Files closed, Where would input this code
Code:
SELECT
    yourTable.GroupID,
    Sum([File Closed]*-1) AS [Total File Closed],
    Sum([File Closed]+1) AS [Total File Open]
FROM yourTable
GROUP BY yourTable.GroupID;
 

cheekybuddha

AWF VIP
Local time
Today, 17:13
Joined
Jul 21, 2014
Messages
2,320
Where would input this code
Create a new query.

Don't add any tables.

Switch to SQL view.

Paste in the SQL suggested.

Run the query to see the results.

Open in design view if you wish to see how Access translates the SQL to the query.
 

Users who are viewing this thread

Top Bottom