Floating Decimal in MS Access 2003

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
 
O

onedaywhen

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.

--
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top