Convert to 2 decimal places?

That is because the COMMA is not a numeric character (±.0123456789) so if you are going to allow the user to enter a comma, then remove it for them

I don’t know exactly how you are accepting input but there are two things you can do.

a) Subclass the Textedit control (assuming that is what you are using) to not allow a comma to be entered
b) use REPLACE to change the comma to “”

Now I’m an AMERICAN so forgive my ignorance here… but if you are expecting the “,” to work as I would expect a decimal point, then you need (I believe) to insure that the SYSTEM level (not app level) preferences are set that way

On OSX under SYSTEM PREFERENCE (Language & Region) I think you need to set (under GENERAL) GROUPING to be “decimal point” and DECIMAL to be “comma” (in the US it is exactly opposite of that)… the Format should still be the way I showed

For Windows… I have no idea how to set these.

Unfortunately, removing the comma is not really an option because if the user enters an income value of 56499, it is not easily readable, as opposed to 56,499

It looks as if it is not possible then, because the comma needs to be there for legibility reasons, but the comma is not a numerical character.

:frowning:

Again you seem to have a problem separating STORAGE vs DISPLAY

REMOVE the “,” (thousand separator) just before you STORE the value in the database, the FORMAT command will put it back for DISPLAY purposes

Obviously what you are attempting to do, can be done as there are thousands upon thousands of programs out there that handle currency values and have to contend with exactly the issues you are describing.

data going INTO the database

   VAL(REPLACE(textfield1.text),",",""))

data coming OUT of the database to be displayed

  FORMAT(rs.field("money").currencyvalue,"-###,###,##0.00")

this also keeps everything as a STRING if you want it to.

Dave,
thank you so much for all your help.
The following line of code you so kindly gave me unfortunately throws an error - “This method requires more parameters than were passed”.

VAL(REPLACE(fldAmount.text),",",""))

result = Val(string)
http://documentation.xojo.com/index.php/Val

http://documentation.xojo.com/index.php/ReplaceAll
result=ReplaceAll(sourceString, oldString, newString)

VAL(REPLACE(fldAmount.text,",",""))

Thank you everyone !