Floating Decimal in MS Access 2003

  • Thread starter Thread starter robboll
  • Start date Start date
R

robboll

At least I think it may be referred to a as a floating decimal. I have
an input form that has a single where a user can enter data as follows:

12345 or 12345.67 or Text

When the user enters the value, he also selects a radio button
indicating whether it is a whole number, currency (with decimals) or if
it is text.

The problem is that when I use the format function:
Format([Numbers],"$#,##0.00") with an integer where I don't want
decimals -- decimals are included anyway. (i.e., 12345.00).

How I solved the problem is with this IIF statement:

Table1 Structure:
Field: Numbers, Text, 50

SELECT Table1.Numbers,
IIf([Numbers]-Int([Numbers])<>0,Format([Numbers],"$#,##0.00"),Format([Numbers],"#,##0"))
AS Result
FROM Table1;

Is there a simpler, better way to do this?

Thanks for any tips.

RBollinger
 
robboll said:
When the user enters the value, he also selects a radio button
indicating whether it is a whole number, currency (with decimals) or if
it is text.

You should not be using one column for text AND integers AND currency.
You should not be using a column name 'numbers', especially one that
contains text. Post your validation rules for this column and maybe
someone can figure out what you are trying to achieve.

Jamie.

--
 
Back
Top