Forums
This topic is locked
FormatNumber problem with Masterpage Type Mismatch
Posted 23 Sep 2002 06:36:43
1
has voted
23 Sep 2002 06:36:43 David Knapp posted:
I have a page that displays a given set of records. One of them is a number field which I would like to format with commas using the "FormatNumber" function in VBscript. I am using ASP pages as my server model. I can display everything fine until I change the dynamic TExt from: <%=(rsAutolist.Fields.Item("auto_price"

I receive this error in IE:
Error Type:
Microsoft VBScript runtime (0x800A000D)
Type mismatch: 'FormatNumber'
/panhandleauto/html/default.asp, line 391
It should be noted that if I use the FormatNumber string at the top of the page - outside of the table my master list is in - it displays the first number in my recordset properly!
Please help!
Replies
Replied 23 Sep 2002 10:33:21
23 Sep 2002 10:33:21 Vince Baker replied:
you could try the following before the <head> tag but after your recorset:
<% Dim strAutoPrice
strAutoPrice = FormatNumber((rsAutolist.Fields.Item("auto_price"
.Value),bolCommas)
%>
Then add the following where you want the field to appear on your page:
<% Response.write("strAutoPrice"
%>
Regards
Vince
Response.write("The best line of code you can ever use"
VBScript | ASP | HTML | SQL | Oracle | Hosting
<% Dim strAutoPrice
strAutoPrice = FormatNumber((rsAutolist.Fields.Item("auto_price"

%>
Then add the following where you want the field to appear on your page:
<% Response.write("strAutoPrice"

Regards
Vince
Response.write("The best line of code you can ever use"

VBScript | ASP | HTML | SQL | Oracle | Hosting
Replied 24 Sep 2002 04:51:30
24 Sep 2002 04:51:30 David Knapp replied:
I tried what you said but it just writes "StrAutoPrice" where it should be displaying the miles. It is like it forgets that I set that name to a variable. I tried putting the variable in different places, but to no avail. (I put it right after the recordset, and then right before the <head> tag
Replied 24 Sep 2002 04:52:03
24 Sep 2002 04:52:03 David Knapp replied:
I meant price, not miles - in that last reply
Replied 24 Sep 2002 19:55:04
24 Sep 2002 19:55:04 David Knapp replied:
Figured it OUt!
It was so simple.. and it is built in to Dreamweaver Ultradev. I just selected my dynamic text in the design view and then went into Data Bindings, and next to the record I had selected, there is was a little drop down arrow. From this I selected Number, round to Integer. This works perfect now. -- I think it had a problem with my syntax before. The new syntax is:
<%= FormatNumber((rsAutolist.Fields.Item("auto_miles"
.Value), 0, -2, -2, -2) %>
cool.
It was so simple.. and it is built in to Dreamweaver Ultradev. I just selected my dynamic text in the design view and then went into Data Bindings, and next to the record I had selected, there is was a little drop down arrow. From this I selected Number, round to Integer. This works perfect now. -- I think it had a problem with my syntax before. The new syntax is:
<%= FormatNumber((rsAutolist.Fields.Item("auto_miles"

cool.