Hi All
When I retrieve this data into standard text boxes (using ASP/ADO) so that
the user can update/file the following problems occur on what I would call
price fields:
10 << I want 10.00
11.6 << I want 11.60
12.89 << this is fine
My MySQL DB holds prices as decimal(10,3) so I know the decimal data isn't
chopped at this point.
Before the data is displayed in these boxes I created the below function to
parse the data before it is written to the boxes:
eg, s can equal 10 or 11.2 or 12.89 .... etc....even Fred, Steve, etc
Function ReFormatIfNum(s)
dim decNumTest
decNumTest = MID(s,1,InStr(s,"."))
IF LEN(decNumTest) = 0 THEN decNumTest = s
IF IsNumeric(decNumTest) THEN
s = FormatNumber(s)
s = Replace(s,",","")
END IF
ReFormatIfNum = s
End Function
This seems to coveer 10.5's, 12.3's etc (ie 1 DP missing), but prices with
no DPs (eg 10, 8, etc) don't get past the IsNumeric test. How come?
I thought the above would be water-tight for these, but I can't get the no
DPs to show 2 DPs.
Please note that I pass string based data through this function on a generic
loop as I'm trying to make this as automated as possible.
Do you have any idea as to what I'm doing wrong?
Thanks
Laphan