Checkbox Totals, how to?

Jaydub1991

New member
Local time
Today, 15:51
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
 
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
 
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?
 
SQL:
SELECT
  GROUPID,
  -SUM(FileClosed) AS numClosed,
  SUM(IIf(FileClosed = False, 1, 0)) AS numOpen
FROM myTable
GROUP BY
  GROUPID
;
 
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

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;
 
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

Back
Top Bottom