Connecting Tech Pros Worldwide Forums | Help | Site Map

Can I Format numbers with VBScript as in MS Access?

Member
 
Join Date: May 2008
Posts: 44
#1: Nov 12 '08
Is there a way to format numeric data in vbscript? In access, I could write:
format(dbTestVariable,"0.00%"). This does not work when I embed it on the ASP page.

jhardman's Avatar
Moderator
 
Join Date: Jan 2007
Location: logan, utah
Posts: 2,690
#2: Nov 13 '08

re: Can I Format numbers with VBScript as in MS Access?


try formatnumber(), let me know if it helps.

Jared
Member
 
Join Date: May 2008
Posts: 44
#3: Nov 18 '08

re: Can I Format numbers with VBScript as in MS Access?


Quote:

Originally Posted by jhardman

try formatnumber(), let me know if it helps.

Jared

Jared,
It worked! Thanks for the help. Related to this issue, I was able to type:

<%=FormatNumber(dbMthBudFTF,2)% to get the 2 digit decimal place. Is there a way to format as a percentage, like in MS Access: Format(dbMthBudFTF,"0.00%").

Thanks again,
Ralph
jhardman's Avatar
Moderator
 
Join Date: Jan 2007
Location: logan, utah
Posts: 2,690
#4: Nov 18 '08

re: Can I Format numbers with VBScript as in MS Access?


Sorry if my original answer didn't completely answer you. try:
Expand|Select|Wrap|Line Numbers
  1. <%=FormatPercent(dbMthBudFTF,2) %>
Quote:

Originally Posted by w3schools

Function Description
FormatCurrency Returns an expression formatted as a currency value
FormatDateTime Returns an expression formatted as a date or time
FormatNumber Returns an expression formatted as a number
FormatPercent Returns an expression formatted as a percentage

w3School's explanation . W3schools is a very good resource, worth playing around on and hanging out. Anyway, let me know if it helps.

Jared
Member
 
Join Date: May 2008
Posts: 44
#5: Nov 19 '08

re: Can I Format numbers with VBScript as in MS Access?


Jared,

It worked great. Thanks much!
Reply


Similar ASP / Active Server Pages bytes