Results 1 to 5 of 5
  1. #1
    Rhubie is offline Advanced Beginner
    Windows 7 64bit Access 2010 64bit
    Join Date
    Aug 2012
    Posts
    85

    Query Calculation

    I have a query calculated field that I need to do another calculation on



    Price (calculated field)
    New calculation on that field -
    I want to substract 4% and round to the nearest nickel.

    Not sure if I can do this on a calculated field - not sure how to do the calculation in access?

    Example: Round(20*(([BookPrice]-([BookPrice]*1.04))+5),0)/20
    Last edited by Rhubie; 02-01-2013 at 11:33 AM. Reason: added example of my calculation

  2. #2
    alansidman's Avatar
    alansidman is offline Indifferent
    Windows 7 32bit Access 2010 32bit
    Join Date
    Apr 2010
    Location
    Steamboat Springs
    Posts
    2,536
    In Access it is sometimes an issue trying to calculate an expression on a calculated field. To assure success, bring your calculation into a new field and add the needed calculations to it.

    Example: (yourOriginalCalculation)-round(.04*(yourOriginalCalculation),roundFactor)

    to round to the nearest nickel, look at this explanation by Allen Browne http://allenbrowne.com/round.html

  3. #3
    Rhubie is offline Advanced Beginner
    Windows 7 64bit Access 2010 64bit
    Join Date
    Aug 2012
    Posts
    85
    I already have a round in the original calculation - will that be a problem? I'm confused.

    BookPrice: IIf([WBCode]="03-N0051" Or [WBCode]="03-N0061",Null,Round(20*(([PackPrice]/20)+5),0)/20)

  4. #4
    alansidman's Avatar
    alansidman is offline Indifferent
    Windows 7 32bit Access 2010 32bit
    Join Date
    Apr 2010
    Location
    Steamboat Springs
    Posts
    2,536
    What happens when you try? Does it work?

    Alternatively if you want to just calculate on the BookPrice field, you could create a new query based upon the current query and run a calculation based upon the field name BookPrice. Don't know what you think of having two queries to get your answer. Sometimes, it is just easier.

  5. #5
    Rhubie is offline Advanced Beginner
    Windows 7 64bit Access 2010 64bit
    Join Date
    Aug 2012
    Posts
    85
    I can get the formula to work - WSBookPrice: [BookPrice]-([BookPrice]*0.04), but when I try to round up to the nickel - it is not working

    WS: Round(20*([BookPrice]-([BookPrice]*0.04))+5,0)/20

    Not sure what I am doing wrong - I am getting 44.25 it should be 44.05

    BookPrice is 45.85

    got it - needed to be +.5
    Last edited by Rhubie; 02-01-2013 at 01:24 PM. Reason: Added additional information

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

Similar Threads

  1. Calculation Field in table vs Query calculation
    By Leonidsg in forum Database Design
    Replies: 18
    Last Post: 02-28-2013, 09:38 PM
  2. Query Calculation
    By Rhubie in forum Access
    Replies: 3
    Last Post: 08-28-2012, 01:41 PM
  3. calculation in a query
    By funi.t in forum Reports
    Replies: 5
    Last Post: 01-25-2012, 05:24 AM
  4. Query calculation
    By Charter in forum Queries
    Replies: 8
    Last Post: 12-30-2011, 11:50 AM
  5. IIF() in a query calculation
    By bbylls in forum Queries
    Replies: 4
    Last Post: 12-03-2009, 04:42 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