Results 1 to 7 of 7
  1. #1
    Messacar is offline Novice
    Windows 10 Access 2010 64bit
    Join Date
    Jul 2019
    Posts
    2

    Couunting Trues

    As you’ll see I’m a still real novice at this, but here goes:

    I’ve developed an Access DB for our magazine collections numbering around 20,000 copies (strictly a guesstimate since there’s been no real method of counting them).

    A sample of the query follows:

    What shows here as true/false is a tick mark (true) is a copy that we have. Is there any way that I can count the number in our possession?

    Any and all help appreciated.
    Fred

    Issue Key Magazine Title Alternate Title 1 Issue Year Volume Numbers January February March April May June July August September October November December Notes-1 Full Size or Model Delete Record
    144 Model Aviation (USA)
    1936
    False False False False False True True True False False False False
    M False
    144 Model Aviation (USA)
    1942


    True True True True True True True True True True True True
    M False
    144 Model Aviation (USA)
    1943
    True False False False False False False False False False False False
    M False
    144 Model Aviation (USA)
    1953
    False False True False False True False False False False False False
    M False
    144 Model Aviation (USA)
    1955
    False True False True False False True False False True True True
    M False
    144 Model Aviation (USA)
    1956
    False False False True False True True False False True False False
    M False
    144 Model Aviation (USA)
    1957
    True True True True True True True True False True True True
    M False

  2. #2
    davegri's Avatar
    davegri is offline Excess Access
    Windows 11 Access 2021
    Join Date
    May 2012
    Location
    Denver
    Posts
    3,740
    Maybe add a column to the query:
    IssueCount: Sum(January, February, March, April, May, June, July, August, September,October, November, December) * -1


    since TRUE is minus one (-1) you need to multiply the sum of the months by minus one to get a positive result.

  3. #3
    June7's Avatar
    June7 is offline VIP
    Windows 11 Access 2021
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,770
    True = -1 and False = 0.

    Do you want to sum records as well as month fields? Should post your query SQL.

    SELECT *, (January, February, March, April, May, June, July, August, September, October, November, December) * -1 AS TotalMonths FROM table;

    or

    SELECT Sum(January, February, March, April, May, June, July, August, September, October, November, December) * -1 AS TotalMags FROM table;
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  4. #4
    xps35's Avatar
    xps35 is offline Competent Performer
    Windows 10 Office 365
    Join Date
    Jun 2022
    Location
    Schiedam, NL
    Posts
    299
    Why do you store copies that are missing for years you have a copy only?

    I think you should only store copies you own in 2 tables. One tabel being Magazine the second one Copy (MagazineID, Year, Month). Counting is a piece of cake then.
    Groeten,

    Peter

  5. #5
    Micron is offline Very Inert Person
    Windows 10 Access 2016
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    13,421
    I suspect the table(s) look just like that query, in which case the db would not be normalized. That alone makes counting anything more difficult.
    The more we hear silence, the more we begin to think about our value in this universe.
    Paraphrase of Professor Brian Cox.

  6. #6
    jojowhite's Avatar
    jojowhite is online now Competent Performer
    Windows 11 Access 2021
    Join Date
    Jan 2025
    Posts
    432
    Code:
    SELECT 
        [Issue Key], 
        [Magazine Title], 
        Sum((January, February, March, April, May, June, July, August, September, October, November, December) * -1) As TotalIssued 
    FROM YourTableName 
    GROUP BY 
        [Issue Key], 
        [Magazine Title];

  7. #7
    Gustav's Avatar
    Gustav is offline Advanced Beginner
    Windows 11 Office 365
    Join Date
    Jan 2025
    Posts
    32
    Run this query:

    Code:
    SELECT 
        [Issue Key], [Magazine Title], [Issue Year],
        Abs(Sum([January]+[February]+[March]+[April]+[May]+[June]+[July]+[August]+[September]+[October]+[November]+[December])) AS Issues
    FROM 
        Magazines
    GROUP BY 
        [Issue Key], [Magazine Title], [Issue Year]

    Result:

    Click image for larger version. 

Name:	Skærmbillede 2025-05-30 084207.png 
Views:	24 
Size:	11.5 KB 
ID:	53060

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 1
    Last Post: 03-27-2012, 04:49 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums