Results 1 to 3 of 3
  1. #1
    MFS is offline Competent Performer
    Windows 7 32bit Access 2010 32bit
    Join Date
    Mar 2009
    Location
    Ohio
    Posts
    235

    Decimal point issue, Unbound Textbox In Form with math equation

    I have an unbound textbox in my form where I have entered a math equation, the equation works very well however the numbers could possibly show up to infinite.
    ie 23.187678498979843569784938269437256764328



    I would only like the textbox to show 23.18
    I've tried setting the "Format" in properties to General Number and "Decimal Places" to 2.

    I hope someone can help me get this formatted correctly.

    Speck

  2. #2
    ItsMe's Avatar
    ItsMe is offline Sometimes Helpful
    Windows 8 Access 2013
    Join Date
    Aug 2013
    Posts
    7,862
    You might be able to get what you want using Format = General Number and Decimal Places = 2. However, understand that the format is only something that is displayed to the user. The underlying data that is actually being stored will likely be very different. This might cause issue when running aggregate calcs on data stored in tables.

    What I will typically do is use a specific data type in VBA code and do data validation before assigning the value to the field within the table. Using variables with specific data types and doing validation will likely bypass any need for using the Format property and will also provide more reliable results when doing math on the data stored in your tables.

    This reference may offer some help
    https://msdn.microsoft.com/en-us/lib...ffice.14).aspx

  3. #3
    NTC is offline VIP
    Windows 7 64bit Access 2013
    Join Date
    Nov 2009
    Posts
    2,392
    Set your property to 'Fixed' and decimals property to '2'.

    that's step 1; but in your example it is going to display 23.19 not 23.18 due to normal rounding.

    If you require round down - then bing/google on that that topic

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

Similar Threads

  1. Delete Zero after decimal point!
    By cuongmyh in forum Forms
    Replies: 1
    Last Post: 02-26-2015, 07:06 AM
  2. Convert decimal comma to decimal point
    By Hans Karlsson in forum Programming
    Replies: 3
    Last Post: 06-30-2014, 01:56 PM
  3. Unbound, form textbox populated
    By WiReLaD in forum Access
    Replies: 7
    Last Post: 11-19-2012, 12:54 PM
  4. Unbound textbox in bound form
    By Evilferret in forum Forms
    Replies: 5
    Last Post: 08-15-2012, 01:26 PM
  5. Replies: 4
    Last Post: 08-14-2012, 10:33 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