Results 1 to 12 of 12
  1. #1
    faca is offline Advanced Beginner
    Windows 10 Access 2016
    Join Date
    Mar 2018
    Posts
    52

    SUM function

    Hello!



    How can i make SUM of value that is calculated in form not in query?

    Thanks

  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,652
    In the form footer:

    =Sum(FieldName)

    presuming the field is in the form's record source.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  3. #3
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,652
    Or if you mean on the form is

    =Price * Quantity

    and you want to sum it,

    =Sum(Price * Quantity)
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  4. #4
    faca is offline Advanced Beginner
    Windows 10 Access 2016
    Join Date
    Mar 2018
    Posts
    52
    In query i have:

    Price: [Quantity] * [SellingPrice]

    In form:
    Tax: =[Price] * [TaxRate]/100

    SubTotal: =[Tax] + [Price]

    And i need a to make Total: SUM[SubTotal] but it doesnt work...

  5. #5
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,652
    As mentioned in post 3, you can sum the calculation. Or you can move the other calculations out to the query.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  6. #6
    faca is offline Advanced Beginner
    Windows 10 Access 2016
    Join Date
    Mar 2018
    Posts
    52
    Yes i've tried that but i get #Error

  7. #7
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,652
    Well, not seeing exactly what you tried, I can only speculate. Make sure there isn't a textbox with the same name as a field.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  8. #8
    faca is offline Advanced Beginner
    Windows 10 Access 2016
    Join Date
    Mar 2018
    Posts
    52
    I tried this:

    =SUM([Tax]*[Price])
    and
    =SUM([SubTotal])

    both options give me error

  9. #9
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,652
    Of course, both try to sum a calculated control. I'd move it all to the query, but this should work:

    =Sum(([Price] * [TaxRate]/100) + [Price])

    I'd probably add the Round() function in there.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  10. #10
    faca is offline Advanced Beginner
    Windows 10 Access 2016
    Join Date
    Mar 2018
    Posts
    52
    I've attached database so you can check and maybe fix this beacuse it's still error...

    just open up ServiceParts form...

    Attachment 37972

  11. #11
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,652
    Quote Originally Posted by faca View Post
    In query i have:

    Price: [Quantity] * [SellingPrice]
    This is not accurate. TaxRate isn't in the record source, should be. Can it vary by item? SellingPrice is in both Material table and ServiceParts table; can it be different?
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  12. #12
    faca is offline Advanced Beginner
    Windows 10 Access 2016
    Join Date
    Mar 2018
    Posts
    52
    TaxRate is in cboMaterial (it's not same for all parts)... SellingPrice is in both tables beacuse at first i didn't know how to fix problem when for example price for brakes changed from 20€ to 25€ and when i changed price in Material table than it was changed also in all previous services so that's why SellingPrice in both tables, now when i change price all previous services still have same one...

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

Similar Threads

  1. Replies: 15
    Last Post: 10-17-2018, 09:26 PM
  2. Replies: 15
    Last Post: 05-31-2017, 02:10 PM
  3. Replies: 2
    Last Post: 02-26-2017, 11:31 AM
  4. Replies: 3
    Last Post: 03-04-2016, 10:36 AM
  5. Replies: 8
    Last Post: 11-04-2014, 10:44 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