Results 1 to 5 of 5
  1. #1
    Jerry Call is offline Advanced Beginner
    Windows 10 Office 365
    Join Date
    May 2020
    Location
    Champaign, Illinois
    Posts
    85

    Calclulation limitation in numerical and currency expressions in Access

    It appears that one cannot combine a numeric-type with a currency-type in a single Access expression.


    Suppose, for example that NumberInFullCase is numeric type (e.g., 220), while FullUnitCaseCost ($45.99) is currency.
    Calling for FullUnitCaseCost/NumberInFullCase in the hope of setting a default value for a currency PieceCost field
    in a table's design section crashes.

    I tried making everything numeric, but that didn't work either.

    It seems ridiculous that I should have to use an Excel spreadsheet to calculate the necessary values
    and then copy the results into my Access table. Access reports let me do all kinds of calculations,
    but I can't figure out how to get results for a "mixed" item in a table or its accompanying form.

  2. #2
    kd2017 is offline Well, I tried at least.
    Windows 10 Access 2016
    Join Date
    Jul 2017
    Posts
    1,142
    Are you trying to create a calculated field in your table? If so you probably shouldn't anyway, just use a query to run your calcs.

  3. #3
    ssanfu is offline Master of Nothing
    Windows 10 Access 2010 32bit
    Join Date
    Sep 2010
    Location
    Anchorage, Alaska, USA
    Posts
    9,664
    Calculations should NOT be done at the table level, they should be done in a query.
    If you have a table with fields NumberInFullCase (as long integer) and FullUnitCaseCost (as Currency), then create a query
    Code:
    SELECT tblCurrencyCalc.NumberInFullCase, tblCurrencyCalc.FullUnitCaseCost, [NumberInFullCase]/[FullUnitCaseCost] AS PieceCost
    FROM tblCurrencyCalc;
    (change tblCurrencyCalc to the name of your table)
    the result is 0.209045454545455.


    With Rounding
    Code:
    SELECT tblCurrencyCalc.NumberInFullCase, tblCurrencyCalc.FullUnitCaseCost, Round([FullUnitCaseCost]/[NumberInFullCase],2) AS PieceCost
    FROM tblCurrencyCalc;
    the result is 0.21

    You can format the value in a control on a form/report the way you want. (Currency)

  4. #4
    Jerry Call is offline Advanced Beginner
    Windows 10 Office 365
    Join Date
    May 2020
    Location
    Champaign, Illinois
    Posts
    85
    Yes, I see the light now. The calculations can be done in a query. I discovered they can
    also be done in a report. So this one is "solved."

    Alas, I am still unable to locate the tag that marks the thread as solved. If you would just put the relevant button at the top of the Quick Reply it would be much more intuitive.

  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,521
    Quote Originally Posted by Jerry Call View Post
    Alas, I am still unable to locate the tag that marks the thread as solved. If you would just put the relevant button at the top of the Quick Reply it would be much more intuitive.
    FYI you can mark the thread solved via the "Thread Tools" dropdown at the top of the thread. I doubt the forum owner can control where it is.
    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. Replies: 4
    Last Post: 08-27-2021, 01:50 PM
  2. information on MS Access login limitation
    By Crystan in forum Access
    Replies: 6
    Last Post: 03-09-2020, 11:58 PM
  3. Replies: 6
    Last Post: 01-23-2018, 10:06 AM
  4. Replies: 3
    Last Post: 04-24-2016, 07:24 AM
  5. Replies: 13
    Last Post: 05-29-2015, 11:32 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