Results 1 to 8 of 8
  1. #1
    deepakg27 is offline Competent Performer
    Windows 10 Access 2013 64bit
    Join Date
    Nov 2017
    Posts
    160

    How to Perform 2 Calculations in a query and only show result of One

    Hi guys,

    As per the suggestions and guidance provided, I am trying to shift from calculated fields all together and use queries for calculating values and later storing the results to the fields, for my billing database.

    I have created a query for Tax Amount, where I am Calculating Amount(AMT = (Qty*Rate)) and further calculating Tax Amount (TAMT =(AMT* TaxRate/100)). Now the query works fine, if I set the property of AMT to show. As soon as I shift the property of AMT to not Show, It starts asking me for value of AMT. I only want to show the value of Tax Amount (i.e. TAMT). As i need that value to store in Tax amount column in my table.



    Both calculations are enclosed in ROUND Function.

    Your help is much appreciated.

    Thanks and Regards
    Deepak Gupta

  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
    If you're not going to show it, why bother with it? Just put that calculation in place of AMT in the final calculation.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  3. #3
    deepakg27 is offline Competent Performer
    Windows 10 Access 2013 64bit
    Join Date
    Nov 2017
    Posts
    160
    Thanks Pbaldy,

    Never thought of it. Will try that. In any case if I want to still calculate AMT & Tax Rate Separately is it possible to make two calculations and show only one.

    Thanks and Regards
    Deepak Gupta

  4. #4
    deepakg27 is offline Competent Performer
    Windows 10 Access 2013 64bit
    Join Date
    Nov 2017
    Posts
    160
    Unable to make the calculation if I put everything at one place. Syntax problem, unable to write the formula for this part in the query. Please help.

  5. #5
    Micron is offline Virtually Inert Person
    Windows 7 32bit Access 2007
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    12,784
    As soon as I shift the property of AMT to not Show, It starts asking me for value of AMT
    I'm presuming AMT is a field. If you don't elect to show it, you're not returning it thus you can't use it. You can elect to not show fields by unchecking the show box and still use the field to apply criteria to the results. But if you expect to use a field in a calculation, you have to return it. If you are following other advice, you were likely told to use forms along with your queries, in which case, you return whatever values are needed for the calculations and either perform the calculations on forms in unbound textboxes, or if in queries, you return the value to the form based on that query but don't show it on the form. Not sure you should be storing the calculations either.
    The more we hear silence, the more we begin to think about our value in this universe.
    Paraphrase of Professor Brian Cox.

  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
    This doesn't work?

    ((Qty*Rate) * TaxRate/100)
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  7. #7
    deepakg27 is offline Competent Performer
    Windows 10 Access 2013 64bit
    Join Date
    Nov 2017
    Posts
    160
    Thanks pbaldy.
    Found my mistake.

    Regards
    Deepak Gupta

  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
    Glad you found it.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

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

Similar Threads

  1. Perform calculations in the query
    By Mehvan in forum Queries
    Replies: 11
    Last Post: 10-01-2016, 03:39 AM
  2. Replies: 12
    Last Post: 01-06-2016, 10:08 PM
  3. Replies: 6
    Last Post: 11-21-2014, 05:35 PM
  4. Replies: 1
    Last Post: 10-08-2012, 03:35 PM
  5. Replies: 2
    Last Post: 04-18-2011, 02:46 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