View Full Version : Textbox decimal places format
Bobby1st 05-09-2008, 06:17 AM Hello,
I have two columns on a table, one Col A is an integer with zero decimal places and in Col B is formatted to 3 decimal places (0.020).
On the Report I have a textbox with data source formula: = iif([Col A]= 0, [Col B], [Col A]) If I format the textbox with 3 decimal place and the result in Col A is 2, it will show 2.000. I wanted it to show just "2". If the result is from Col B, it will be perfect.
If I format the textbox to zero decimal places and the result is from Col B, say 0.310, it will show as "0" or even I made the format as 1 decimal places still cut-off.
How would I make the decimal format conform with the result?
Thank you.
Fifty2One 05-10-2008, 10:53 AM in a text box control source put
=FormatNumber([fieldname],1)
that will give you one number after the decimal
What data type is column B?
gemma-the-husky 05-11-2008, 09:27 AM try general number format
look for it - general will give general date first
Bobby1st 05-12-2008, 07:38 AM Hello Guys, Please see next one below. Thanks,
Bobby1st 05-12-2008, 07:42 AM Hello Guys,
It's half working, I tried various configurations, Here's what my table and report formats.
. . . . The dots are for spacing only.
Table contains:
EmpId, Month, OP1, Create, OP2, Treat, OP3, Act, etc.
AA . . . Nov07 . . . . , 0.010, . . .,0.010,. . . . , 0.010
AA . . . Dec07 . . . . , 0.010, . . .,0.010,. . . . , 0.010
AA . . . Jan08 . . 2 . , 0.010, . 2 .,0.010, . 2 . , 0.010
AA . . . Feb08 . . 3 . , 0.015, . 3 .,0.015, . 3 . , 0.015
AA . . . Mar08 . . 3 . , 0.015, . 3 .,0.015, . 3 . , 0.015
OP1 = Integer
Create = double
Textbox decimal Place format is 3 for OP1/Create
=IIf([OP1]="",[Create],formatnumber([OP1],0))
Report results
EmpId, Month, OP1/Create, I want it >> OP1/Create,
AA Nov07 . . . . . . . . . . . . . . . . . . 0.010
AA Dec07 . . . . . . . . . . . . . . . . . . 0.010
AA Jan08 . . . . . 2 . . . . . . . . . . . . . . 2
AA Feb08 . . . . . 3 . . . . . . . . . . . . . . 3
AA Mar08 . . . . . 3 . . . . . . . . . . . . . . 3
Thanks,
jwood29 05-14-2008, 10:42 AM Anybody figure this out. I have exact same issue.
I have a text box. General Number, two decimal places.
when I enter .50 it displays 0 (zero).
when I enter .55 it displays 1.
when I enter .75 it displays 1.
when I enter 1.60 it displays 2.
Basically it either rounds up or down, and does not have the functionality to enter the exact figure I input like .50 or 2.75.
Hoping someone can steer me in the right direction.
Thanks in Advance.
EDIT: Wow, I found the answer myself. Shocking.
It was in the actual settings of the hours in the table, which is linked to my text box.
Here are my settings: I think it was the fact that field size was set to integer and not decimal and scale was set to 0.
Field Size: Decimal
Format: General Number
Precision: 10
Scale 4:
Decimal Places: 4
~jwood29
Bobby1st 05-15-2008, 11:06 AM Jwood29,
Here are my settings: I think it was the fact that field size was set to integer and not decimal and scale was set to 0.
Field Size: Decimal
Format: General Number
Precision: 10
Scale 4:
Decimal Places: 4
I appreciate this direction, IT WORKS!!
Although our situation is not exactly the same but close, I am dealing with integer and decimals.
My text box which contains: =IIf([OP1]="",[Create],formatnumber([OP1],0)) now contains IIf([OP1]="",[Create],[OP1]), Thank you to Fifty2One. The reason for the changes was it won't pickup the value from [Create] if [OP1] contains zero.
I did the changes on the table properties using your GREAT idea. You deserve a Kudos through your reputation.
Once again thank you.
Bobby1st
WinDancer 11-13-2008, 07:49 AM I found this solution via the search feature... it is exactly what I was looking for and it worked flawlessly.
Thanks, folks!
Dave
|
|