G
|
georgeb 4/30/2011 |
In Sql, I have some float/numeric fields that have a value of 600.00, but even if I change the display-as to currency or numbers with 2 decimals in the forms, they show up as 600 with no decimals. They should be shown as $600.00.
|
G
|
georgeb 4/30/2011 |
float and decimal data types are very different by definition the float data type "floats" the decimal place ie 600.00 is 600 600.10 is 600.1 600.01 is 600.01 etc. the decimal data type allows one to set the precision and scale of the data ie decimal(5,0) is 600 decimal(5,1) is 600.0 decimal(5,2) is 600.00 you still won't get the $ sign as it is a charecter data type and cannot be stored in a numeric field. you will need to fromat the $ using concatenation i belive. HTH George
|
![]() |
Sergey Kornilov admin 4/30/2011 |
FormatCurrency() is the way to go: |
B
|
beachldy author 5/2/2011 |
I understand the SQL formatting, as I tried decimal etc. However, on the EDIT form or ADD form, no matter what I do with ASPRunner on properties, I cannot get the numbers to display with decimals. I've checked it off to display as number with 2 decimals, the data is stored in SQL as 600.00, and still it only shows 600 on the form. Surely the formatting option should take care of this without any additional coding. |
B
|
beachldy author 5/2/2011 |
Another question, if I'm adding ASP code (under the After or Before Record updated), would it be something like this: |
![]() |
Sergey Kornilov admin 5/2/2011 |
You need to apply FormatNumber or FormatCurrency in 'View as' Custom.
value = FormatCurrency(value,2) |
B
|
beachldy author 5/2/2011 |
Tried that too, and it still just shows 600. Ok, I'm really feeling dumb, as I know it's something that should be simple. I'll upload the project. Project 3 is the name. |
B
|
beachldy author 5/2/2011 |
Ok, I uploaded the project but no data is showing up. If you go to STAFF, then SCHEDULES, EDIT....there are no records. My database has some test records in it and although I checked "upload tables", it doesn't seem to be uploading. |
![]() |
Sergey Kornilov admin 5/2/2011 |
Update: correct variable name is strValue strValue = FormatCurrency(strValue,2)
|