Formatting issues

patrickd123

Patrickd123
Local time
Today, 02:19
Joined
Jan 21, 2007
Messages
29
A)On a bound text box, my source has a value with a lot of decimals. I would like the text box to have only 2 decimals.

1-text box format property:currency -> does not work.
2-text box Decimal places property:2 -> does not work.

B)On a bound text box, my source has no value. I would like the text box to default to zero, but it is blank. The source is a calculated field on a query.

1-text box default property:0 -> does not work.
2-Isn't there a way to specify some properties(like format) for calculated fields on a query?

Any idea?

Thank you
 
Re A, it seems it is interpreted as text - are you per chance converting to text (Format function)?

Re B, default value is for new records, but you can use the format property of the control, which takes four arguements/formats (format if positive, negative, zero, Null), for instance something like this (two decimals if it is a value, no decimals for zero and Null)

#,##0.00;#,##0.00;0;0
 
A: No conversion to text(as far as I know). A clue is that it does that for values that are calculated fields on queries. Since they only exist from the queries, I dont see any place to specify atype or a format.

B: when I saw your answer, I was certain you had nailed it. But I did what you said and it did not solve the problem.
 
If your textboxes are linked to fields that are text, then the decimal format has no meaning. 1.23456 is still 1.23456 if it's being stored as text. Switch it to a single to resolve that issue. This may in fact solve both issues. Storing anything as text will almost always screw with the decimal places, formatting, etc.
 
It seems our crystal balls are a bit clouded. You mind posting a bit of information, for instance the SQL? Money format? Do you mean Money datatype as found in SQL server? Is this a linked SQL server thingie, or ADP?
 
you can have your text box number format as fixed, 2 dps, but this is just a display format.

This doesn't change the underlying true value of the data, which MAY therefore introduce computational errors.

if you really should have a limited number of dps you need to validate the initial data entry properly.

eg for 2 dps

(clng(number * 100) /100) = number should be true
 

Users who are viewing this thread

Back
Top Bottom