On a data entry form I am asking users to enter a dollar amount. How can I convert the value they enter if it includes commas to a money or numeric format?
dim moneyVar
moneyVar = request.form("theTextField"
moneyVar = replace(moneyVar, "$", ""
moneyVar = replace(moneyVar, ",", ""
on error resume next
moneyVar = cdbl(moneyVar)
if err.number <> 0 then
'your entry was not numeric, so do something
end if
err.clear
on error goto 0
Gives you a nice variable of subtype, double, that should be suited for entry into a database field -- and if the entry was not numeric, you've handled that, as well.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.