Glenn Cox
asked on
Adjusting decimal places in unbound list box
I have a unbound list box on a form in Access database. I want some values to be 3 decimal places and some to be 4, but all are rounding to two. Some are pulling values from table and some from queries. How can I control the # of decimal places shown on form?
You must define that number in the query that is the rowsource for your listbox
Start out by using the Round([fieldname], decimal places ) function to get the right number of decimals.
Keep in mind, that all entries in a listbox are treated as text and will be left aligned. Another option would be to create a continuous form, which would give you the ability to align these numeric values to the right of a textbox.
Start out by using the Round([fieldname], decimal places ) function to get the right number of decimals.
Keep in mind, that all entries in a listbox are treated as text and will be left aligned. Another option would be to create a continuous form, which would give you the ability to align these numeric values to the right of a textbox.
...For example, in the table, set the field property: Format to "Fixed"
Then set the decimal places property as needed. (2 or 3 ,...or whatever...)
Then when you load these values into the listbox, they will have the desired decimal places.
;-)
JeffCoachman
Then set the decimal places property as needed. (2 or 3 ,...or whatever...)
Then when you load these values into the listbox, they will have the desired decimal places.
;-)
JeffCoachman
The reason I recommended the Round( ) function was that the OP indicated some needed 3 decimals, some need 4. Unfortunately, Access doesn't have a decimal align feature like Word and Powerpoint do. Now, that would be a useful addition.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
OK by me.
Just a note.
With a currency datatype you can set the number of decimals places as well (so there may be no need to change the datatype.
If you change the datatype from Currency you loose the default currency format (Dollar sign, thousandth separator), and you may end up having to "format" the final result as currency anyway...
JeffCoachman
Just a note.
With a currency datatype you can set the number of decimals places as well (so there may be no need to change the datatype.
If you change the datatype from Currency you loose the default currency format (Dollar sign, thousandth separator), and you may end up having to "format" the final result as currency anyway...
JeffCoachman
ASKER
My own comment was the easiest way for me to reach a conclusion. Not saying any of the others wouldn't work, but based on my skill-set this was best approach for me.
I don't think that you can specify that some values in a column to be 3 decimal places and others to be 4.
Or ...are you saying this this is needed for different "Columns".
If so, then set the number of decimal places in the "table" that provides these values.
JeffCoachman