Topics Search

Make A Textbox Always Display 2 Decimal Digits.

Make A Textbox Always Display 2 Decimal Digits.
Views: 23
I use a textbox on a report to display a calculated cost in pounds sterling. If it's 123.45 then it displays both digits, but if it's 123.40 then it only displays 123.4, it drops the trailing zero. It's a little thing, but it matters to me!

The properties of the text box that seem relevant are set to:
Format, currency
Decimal places, 2
visible, yes
Control source, =" " & [SqM]*Forms!frmControlPanel!frmSubOptions.Form!boxCleansingCost
Input mask, blank
running sum, no

And of course the computer is set to English UK. Yes, the one that spells properly! All those stray z's. argh
Sponsored Links:

More topics


Rounding to 2 decimal places

I am computing a value based on a %. If I round and the answer is say 100.125 the result is 100.12 instead of 100.13.

If I add 0.005 I will get the correct value for this, but if I get an answer of say 100.3848 and I round it after adding the .005, my answer is wrong.

My problem would be solved if I could test the number of digits after teh decimal place.

using the right(Cinput, 1) function to test the last decimal, it returns either the 2nd, 3rd or 4th digits depending on how many decimal places there are.

Stop text box from rounding decimals

I am using Access 2003 and have a form with a number of unbound text boxes formatted to Standard number, 2 decimal places.

The problem is that whenever you enter a number with more than 2 decimals the textbox rounds the second decimal place up or down which I don't want. I just want to drop off any decimals greater than 2.

For instance if I enter 12.225 in a textbox the value displayed is rounded up to 12.23 and I want it to display 12.22 and ignore the third decimal.

I tried an input mask and that works but is not ideal for my purpose

Number conversion

I need to convert a number that is currently formatted as Double to a 7-digit format without decimail points. Using a query, I can create the calculated field to get rid of the decimal point, but I need for the field to be 7 digits long, with leading 0s to make up all 7 digits.

For example, 153.15 should become 0015315. I can only get it as far as being 15315. Is there a way I can set Properties to format this field, or is there another expression I can add to my calculation? I'm multiplying the source field by 100 to get rid of the decimal.

Any help will be appreciated as I'm stuck on this step.

label and currency textbox

I have a label with a textbox directly underneath it. The are aligned to the right. The textbox contains a currency amount and yet they do not display aligned.

How can I make the last character of the label line up with the last decimal of a currency value?

Converting COBOL picture format number to regular decimal number using SQL

does anyone know what built in function I can use to conver a COBOL number into a regular decimal number? For example

COBOL Picture

so the number would be 000009059790000

and the conversion would be 6 digits to the right of decimal and 9 digits to the left. so the output I would want is 9059.79

I was doing the following but its displaying the 0's in front and I didnt want I am getting 000009059.790000

LEFT(Income, 9) + '.' + RIGHT(Income

Limiting decimal places

I would like to limit the decimal places on a percentage. The working Expr is [ActiveHours]/[TotalHrsPaid]#100 What would I need to add to restrict it to display only 2 decimal points and to display the percentage sign

Rounded number inside of text

I have a query with a calculation that gives me around 10 digits after the decimal point. Then on a report I want to use that number but only rounded to 3 digits after the decimal point. I could change the format but there is also a twist. I want to put that number inside of text.
Basically I want a control box that has a control source of

="(TRIM GIRTH= " & [Trim Girth] & ")"

Is there a way for me to make it round it to the nearest three while still in the query?

Formatting currency with the cents but without the decimal point

I have a client who needs to export check information in a text format. The bank is requiring that all fields take x number of characters, which I have been able to do except that the check amount needs to read 10 digits without the decimal place. ie: $247.84 becomes 0000024784. I can get it to 00000247.84 with the function Format([CkAmount],00000000.00) but the minute I take out the decimal, I get a decimal, I get 0000000247.

I should also mention that this is an Access 97 db that has to be totally redone at some point in a later version. It won't convert to any higher a version because there is a lot of code in it that goes back to either Access2 or Access 95.

displaying the time 12:00:00 AM

I can make the time 12:00:00 AM display in a textbox by itsself but when I try to make it display with a date if will not show up in the textbox

it seems to be there because I can use datediff and my formula works but cant make it display

Numbers look right on the form, report shows #####

I've just spent a couple days getting a form to display the numbers on a subform with the correct number of decimal places. WHEW!

However, I'm trying to print a report from that form and subform. Of course, we're back to the same problem. I need to see a report AND a subreport that display the same calculations, and I seem to be right back where I started.

On my subreport, the numbers that appeared on the form are back to displaying ####### instead of a few digits with two decimal places.