Page 1 of 2 12 LastLast
Results 1 to 15 of 18
  1. #1
    FranCorona is offline Advanced Beginner
    Windows 7 32bit Access 2007
    Join Date
    May 2013
    Location
    California
    Posts
    74

    Adding Totals to a Query

    I am creating a query with the following fields: Model, Admin, Issue Miles, Turn In Miles, Issue Hours, Turn In Hours


    I need to create a report showing all of these fields but with a total column next to Turn In Miles showing the total of miles used and then beside the Turn In Hours to show total of hours used. It has been a few years since I have "played around" in MS Access and I know this is probably something simple but I don't really have the time to search and read through results.... If anyone can help I would really appreciate it!

    Thanks!

  2. #2
    aytee111 is offline Competent At Times
    Windows 10 Access 2013 64bit
    Join Date
    Nov 2011
    Location
    Nomad
    Posts
    3,936
    Do it in the report, add a textbox with its control source having the calculation.

  3. #3
    FranCorona is offline Advanced Beginner
    Windows 7 32bit Access 2007
    Join Date
    May 2013
    Location
    California
    Posts
    74
    Quote Originally Posted by aytee111 View Post
    Do it in the report, add a textbox with its control source having the calculation.
    I did what you said and put this formula in the text box for the total miles: Sum([BOSS Turn In Miles])-Sum([BOSS Issue Mile])
    And in the text box for total hours: Sum([BOSS Turn In Hours])-Sum(BOSS Issue Hours])

    But it looks like it is calculating all? I need it to show total for that specific admin number. For example HMEE: BOSS Issue Mile = 412 and BOSS Turn In Miles = 743 so I need it to show 743-412=331 and the same thing for total hours. How do I do that? Click image for larger version. 

Name:	milesandhours.png 
Views:	23 
Size:	77.8 KB 
ID:	28742 here is screen shot of report how it is now.

  4. #4
    aytee111 is offline Competent At Times
    Windows 10 Access 2013 64bit
    Join Date
    Nov 2011
    Location
    Nomad
    Posts
    3,936
    Your example as you write it - "BOSS Issue Mile = 412 and BOSS Turn In Miles = 743 so I need it to show 743-412=331" - is the way you want it. Why are you adding "SUM"? These calculations are coming from the query, so SUM means total of all records.

  5. #5
    FranCorona is offline Advanced Beginner
    Windows 7 32bit Access 2007
    Join Date
    May 2013
    Location
    California
    Posts
    74
    Quote Originally Posted by aytee111 View Post
    Your example as you write it - "BOSS Issue Mile = 412 and BOSS Turn In Miles = 743 so I need it to show 743-412=331" - is the way you want it. Why are you adding "SUM"? These calculations are coming from the query, so SUM means total of all records.
    I see, so how do I get it to show the total miles used? (331)

  6. #6
    FranCorona is offline Advanced Beginner
    Windows 7 32bit Access 2007
    Join Date
    May 2013
    Location
    California
    Posts
    74
    I need it show the calculation for each particular admin number, I just used that one for an example.

  7. #7
    aytee111 is offline Competent At Times
    Windows 10 Access 2013 64bit
    Join Date
    Nov 2011
    Location
    Nomad
    Posts
    3,936
    =Nz([BOSS Turn In Miles]) - Nz([BOSS Issue Mile])

  8. #8
    FranCorona is offline Advanced Beginner
    Windows 7 32bit Access 2007
    Join Date
    May 2013
    Location
    California
    Posts
    74
    Thank you so much! Your the best!

  9. #9
    FranCorona is offline Advanced Beginner
    Windows 7 32bit Access 2007
    Join Date
    May 2013
    Location
    California
    Posts
    74
    I have another question. I need to capture daily totals, which I have done in the query but I also need a cumulative total as well as a remaining total. Any help would be greatly appreciated!

  10. #10
    aytee111 is offline Competent At Times
    Windows 10 Access 2013 64bit
    Join Date
    Nov 2011
    Location
    Nomad
    Posts
    3,936
    Group the report on day, in the group footer add textboxes with the calculations (now you use SUM).

  11. #11
    FranCorona is offline Advanced Beginner
    Windows 7 32bit Access 2007
    Join Date
    May 2013
    Location
    California
    Posts
    74
    Thank you! I have another question. I have a recap report that I need to calculate fields with check boxes. So the fields I have are Position-text, move-check box, add-check box, model-text, drop-check box. In the query I have all of these fields grouped then I have them but with count. Then in the report I have formulas to calculate but now that I changed the data type from text to check boxes it isn't calculating correctly. This is one formula I have: Initial request: =Sum([CountOfPosition])-Sum([CountOfAdd]) but it is counting all of the check boxes even if there is not a check in it. Then for the Moves: =Sum([CountOfMove]) and Drops: =Sum([CountOfDrop]) and Adds: =Sum([CountOfAdd]) and then Final Issue Total: =Sum([CountOfPosition])+Sum([CountOfAdd])-Sum([CountOfDrop])
    Click image for larger version. 

Name:	gridrecap.jpg 
Views:	18 
Size:	110.6 KB 
ID:	28830

  12. #12
    aytee111 is offline Competent At Times
    Windows 10 Access 2013 64bit
    Join Date
    Nov 2011
    Location
    Nomad
    Posts
    3,936
    Where did you change the data type to check box? Where is the issue happening, in the query?

  13. #13
    FranCorona is offline Advanced Beginner
    Windows 7 32bit Access 2007
    Join Date
    May 2013
    Location
    California
    Posts
    74
    I changed it after importing it from excel in design view. I am thinking that I am not going to change it to a checkbox and just have the input person mark it with an X instead. Thank you so much for your help with these.

  14. #14
    aytee111 is offline Competent At Times
    Windows 10 Access 2013 64bit
    Join Date
    Nov 2011
    Location
    Nomad
    Posts
    3,936
    There is a way to fix this, don't give up! You are still saying you changed "it", whatever that is?

  15. #15
    FranCorona is offline Advanced Beginner
    Windows 7 32bit Access 2007
    Join Date
    May 2013
    Location
    California
    Posts
    74
    LOL Yes. First it is created in excel and then imported into Access. After importing I went into design view of the table and changed the data type from short text to yes/no with a check box for the look up.

Page 1 of 2 12 LastLast
Please reply to this thread with any new information or opinions.

Similar Threads

  1. Adding Totals to Combo Box
    By adamjon92 in forum Forms
    Replies: 5
    Last Post: 02-25-2016, 02:36 PM
  2. Query for adding totals from several tables
    By rosscortb in forum Queries
    Replies: 7
    Last Post: 01-05-2015, 01:27 PM
  3. adding up totals in query
    By nightangel73 in forum Queries
    Replies: 3
    Last Post: 06-18-2014, 01:02 AM
  4. Replies: 1
    Last Post: 08-06-2013, 07:52 PM
  5. Adding Totals to a query using queryDef
    By jrickels in forum Programming
    Replies: 7
    Last Post: 04-06-2010, 07:47 AM

Tags for this Thread

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