Results 1 to 13 of 13
  1. #1
    cretam is offline Novice
    Windows XP Access 2010 32bit
    Join Date
    May 2013
    Posts
    7

    Help with adding costs up for each machine

    Hi,
    I have sent up a simple table with the following fields:
    ID
    Date
    Time
    Machine
    Description
    Supplier
    Parts Description
    Cost



    Can someone pls tell me how to get a total of costs for each machine?

    Any help would be greatly appreciated.

    Thanks.
    Tammy

  2. #2
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    A totals query

    SELECT Machine, Sum(Cost) As TotalCost
    FROM TableName
    GROUP BY Machine
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  3. #3
    rzw0wr is offline I will always be a newbie
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2013
    Location
    Indiana
    Posts
    479
    Welcome Tammy.

    Some more information is required.
    Where do you want to do the calculations?

    What defines the cost of your machines?

    Dale

  4. #4
    ssanfu is offline Master of Nothing
    Windows XP Access 2000
    Join Date
    Sep 2010
    Location
    Anchorage, Alaska, USA
    Posts
    9,664
    Also be aware that "Date" and "Time" are reserved words in Access and shouldn't be used as object names.

    Here is a list of reserved words:
    http://allenbrowne.com/AppIssueBadWord.html

    You might also read about naming conventions:
    http://access.mvps.org/access/tencommandments.htm (#3)
    http://access.mvps.org/access/lookupfields.htm

    Only use letters, numbers and the underscore in names; spaces and special characters in names are not "good".

  5. #5
    cretam is offline Novice
    Windows XP Access 2010 32bit
    Join Date
    May 2013
    Posts
    7
    Thanks pbaldy - you solved my problem. I will change the objects to name them correctly ssanfu - thanks for the tip.
    I have setup some reports to display the results.
    Thank you again for your help - much appreciated.

  6. #6
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    No problem. Welcome to the site by the way!
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  7. #7
    cretam is offline Novice
    Windows XP Access 2010 32bit
    Join Date
    May 2013
    Posts
    7
    Hi, Sorry to bother you again pbaldy, but would you mind helping me again? I need to be able to do the query below but also select the dates ie. 1/7/12 to 30/6/13. How would I do this?


    Quote Originally Posted by pbaldy View Post
    A totals query

    SELECT Machine, Sum(Cost) As TotalCost
    FROM TableName
    GROUP BY Machine

  8. #8
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    This type of thing, though more commonly done with a form so the user can specify the dates.

    SELECT Machine, Sum(Cost) As TotalCost
    FROM TableName
    WHERE DateFieldName Between #7/1/12# And #6/30/13#
    GROUP BY Machine
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  9. #9
    cretam is offline Novice
    Windows XP Access 2010 32bit
    Join Date
    May 2013
    Posts
    7

    Thanks

    Thank you for your help. I have been trying to find a good example with a form but am not having much luck. I even searched the forum and got a book from the library but no luck. Could you point me in the right direction please as I think it would be better if the user can select the date range ie. might select each month?

    Quote Originally Posted by pbaldy View Post
    This type of thing, though more commonly done with a form so the user can specify the dates.

    SELECT Machine, Sum(Cost) As TotalCost
    FROM TableName
    WHERE DateFieldName Between #7/1/12# And #6/30/13#
    GROUP BY Machine

  10. #10
    cretam is offline Novice
    Windows XP Access 2010 32bit
    Join Date
    May 2013
    Posts
    7
    Thank you for your help. I have been trying to find a good example with a form but am not having much luck. I even searched the forum and got a book from the library but no luck. Could you point me in the right direction please as I think it would be better if the user can select the date range ie. might select each month?

  11. #11
    orange's Avatar
    orange is offline Moderator
    Windows XP Access 2003
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,722
    For well documented and step by step tutorials see Martin Green's site at
    http://www.fontstuff.com/access/index.htm

  12. #12
    cretam is offline Novice
    Windows XP Access 2010 32bit
    Join Date
    May 2013
    Posts
    7

    That worked!

    Thank you for your help - that worked well.

    Quote Originally Posted by pbaldy View Post
    This type of thing, though more commonly done with a form so the user can specify the dates.

    SELECT Machine, Sum(Cost) As TotalCost
    FROM TableName
    WHERE DateFieldName Between #7/1/12# And #6/30/13#
    GROUP BY Machine

  13. #13
    cretam is offline Novice
    Windows XP Access 2010 32bit
    Join Date
    May 2013
    Posts
    7
    Thanks for the link. These tutorials are excellent.

    Quote Originally Posted by orange View Post
    For well documented and step by step tutorials see Martin Green's site at
    http://www.fontstuff.com/access/index.htm

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

Similar Threads

  1. Roll up costs with vba
    By nigelbloomy in forum Programming
    Replies: 1
    Last Post: 07-31-2012, 01:03 PM
  2. Need Copy and Paste Adding Machine
    By jsarnett in forum Access
    Replies: 1
    Last Post: 03-13-2012, 06:16 PM
  3. How to do a sales/costs report from two tables
    By mattorme in forum Queries
    Replies: 0
    Last Post: 11-29-2010, 12:18 PM
  4. Handling Inventory Costs That Change Over Time
    By mubtuhogar in forum Database Design
    Replies: 5
    Last Post: 10-12-2010, 09:19 AM
  5. Report w/o multiple ship costs
    By stattech in forum Reports
    Replies: 1
    Last Post: 06-22-2010, 04:20 AM

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