Results 1 to 5 of 5
  1. #1
    stildawn is offline Competent Performer
    Windows 10 Office 365
    Join Date
    Oct 2013
    Posts
    176

    Numbers With Decimals

    Hi All

    I have a database with a table that I never want to have decimals in certain currency fields, if there is a decimal it needs to be rounded to a whole number.

    Using the design view > decimals property doesnt actually change the data, just how its displayed, which doesnt fix things later on where SQL code etc will still end up displaying the decimal.



    So my question is, how can I hard code certain fields to ONLY be whole number, in real data not just display format.

    Cheers

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    50,036
    Use Number type with Long Integer field size.
    Last edited by June7; 05-05-2021 at 11:53 AM.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  3. #3
    ranman256's Avatar
    ranman256 is online now VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    8,834
    In table design, the field type = CURRENCY
    set DECIMAL PLACES = 0

  4. #4
    June7's Avatar
    June7 is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    50,036
    @ranman256, that does not prevent decimals saved in data - as already noted by OP.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  5. #5
    ssanfu is offline Master of Nothing
    Windows 10 Access 2010 32bit
    Join Date
    Sep 2010
    Location
    Anchorage, Alaska, USA
    Posts
    9,290
    Quote Originally Posted by stildawn View Post
    .....I never want to have decimals in certain currency fields, if there is a decimal it needs to be rounded to a whole number.
    Maybe use the control "Before Update" event to use the Int function with the built in rounding function or your own rounding scheme if you don't want bankers rounding.

    What type of rounding do you want? Bankers, Odd/Even, always round down, always round up, ......?
    HTH
    -----
    Steve
    --------------------------------
    "Veni, Vidi, Velcro"
    (I came; I saw; I stuck around.)

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

Similar Threads

  1. Decimals on reports.
    By Perfac in forum Reports
    Replies: 3
    Last Post: 01-27-2018, 10:10 AM
  2. Replies: 10
    Last Post: 12-08-2015, 05:04 PM
  3. Rounding decimals
    By brianmcleer in forum Access
    Replies: 1
    Last Post: 06-05-2013, 12:37 PM
  4. Age with Decimals?
    By Lowell in forum Access
    Replies: 1
    Last Post: 10-18-2012, 11:13 PM
  5. Replies: 3
    Last Post: 10-04-2012, 11:38 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 - Senior Forums