Query result in Currency format

G

Guest

Anyone know how I can have the resulting query of a sum of number be put in a Currency format? In Access, I can wrap the CCur function around the sum calculation such as CCur(Sum([field])) and have this work. But although FP accepts this without any trouble, it still comes back in a number format. (The real funny thing is that the field I am summing is defined as Currency in the db)

TIA
AC
 
D

David Berry

<% FormatCurrency(rs("FIELD"), 2) %>

rs("FIELD" is the recordset field name and 2 is the number of decimal places

--
David Berry - MCP
Microsoft MVP - FrontPage
FrontPage Support: http://www.net-sites.com/sitebuilder/
-----------------------------------

-----------------------------------

AC said:
Anyone know how I can have the resulting query of a sum of number be put
in a Currency format? In Access, I can wrap the CCur function around the
sum calculation such as CCur(Sum([field])) and have this work. But although
FP accepts this without any trouble, it still comes back in a number format.
(The real funny thing is that the field I am summing is defined as Currency
in the db).
 
G

Guest

Dave

I appreciate your help but I'm afraid I'm still having trouble. I believe the trouble lies in the fact that I am using the Database Results Wizard to perform my queries which won't let me modify its code. I tried to enter your line but it is overwritten by FP. FYI, I have the results coming back in "List - One record per item" format from the wizard

I will perform the query without the wizard if you can advise how I might do that. Thanks again.
 
G

grw

Delete the 'grey' code around the red code for the existing column value

If formatted as a table, itll probably end up looking like :

<td>
<%=FormatCurrency(FP_Field(fp_rs,"YOURFIELD"), 2) %>
</td>




AC said:
Dave -

I appreciate your help but I'm afraid I'm still having trouble. I
believe the trouble lies in the fact that I am using the Database Results
Wizard to perform my queries which won't let me modify its code. I tried to
enter your line but it is overwritten by FP. FYI, I have the results coming
back in "List - One record per item" format from the wizard.
I will perform the query without the wizard if you can advise how I
might do that. Thanks again.
 
G

Guest

I'm *ALMOST* there. I see the line that I have to change now, but deleting all of the grey removes the results altogether. Here is the line that needs the FormatCurrency added to it

<!--webbot bot="DatabaseResultColumn" s-columnnames="Expr1000" s-column="Expr1000" b-tableformat="FALSE" b-hashtml="FALSE" b-makelink="FALSE" clientside b-MenuFormat preview="&lt;font size=&quot;-1&quot;&gt;&amp;lt;&amp;lt;&lt;/font&gt;Expr1000&lt;font size=&quot;-1&quot;&gt;&amp;gt;&amp;gt;&lt;/font&gt;" startspan --><%=FP_FieldVal(fp_rs,"Expr1000")%><!--webbot bot="DatabaseResultColumn" endspan i-CheckSum="13726" --></p

What specifically do I have to delete to allow me to add the FormatCurrency and not have it overwritten?
 
G

grw

Basically everything except :

<%=FP_FieldVal(fp_rs,"Expr1000")%>

Changes to :
<%=FormatCurrency(FP_Field(fp_rs,"Expr1000"), 2) %>



AC said:
I'm *ALMOST* there. I see the line that I have to change now, but
deleting all of the grey removes the results altogether. Here is the line
that needs the FormatCurrency added to it:
<!--webbot bot="DatabaseResultColumn" s-columnnames="Expr1000"
s-column="Expr1000" b-tableformat="FALSE" b-hashtml="FALSE"
b-makelink="FALSE" clientside b-MenuFormat preview="&lt;font
size=&quot;-1&quot;&gt;&amp;lt;&amp;lt;&lt;/font&gt;Expr1000&lt;font
size=&quot;-1&quot;&gt;&amp;gt;&amp;gt;&lt;/font&gt;"
startspan --> said:
What specifically do I have to delete to allow me to add the
FormatCurrency and not have it overwritten?
 
G

Guest

Have you ever done this and had it actually work? I have spent a huge amount of time trying to delete varying portions of the "grey" code with no luck. One of two things either happen. It gets rewritten automatically, or I lose the field all together (but still get the nice yellow blocks above and below).
 
D

David Berry

In your SQL statement try this:

Format(myAmount,'$#,##0.00') as Dollarfield then use DollarField as the
field name.

See http://www.spiderwebwoman.com/resources/dbrwtipsandtricks.asp

--
David Berry - MCP
Microsoft MVP - FrontPage
FrontPage Support: http://www.net-sites.com/sitebuilder/
-----------------------------------

-----------------------------------
AC said:
Have you ever done this and had it actually work? I have spent a huge
amount of time trying to delete varying portions of the "grey" code with no
luck. One of two things either happen. It gets rewritten automatically, or
I lose the field all together (but still get the nice yellow blocks above
and below).
 
G

Guest

Eureka! You've done it. That works for me. I had also previously tried Format(sum(field), "Currency") which works in Access, but not in FP evidently.

I was also able to make the FormatCurrency change suggested earlier by using Notepad and saving it. That works, but only if you don't ever open the file in FP again as it overwrites everything once again. Damn webbots!

Thanks for your help!
 
D

David Berry

And this is why I use straight ASP coding and not the database wizards ;)

--
David Berry - MCP
Microsoft MVP - FrontPage
FrontPage Support: http://www.net-sites.com/sitebuilder/
-----------------------------------

-----------------------------------
AC said:
Eureka! You've done it. That works for me. I had also previously tried
Format(sum(field), "Currency") which works in Access, but not in FP
evidently.
I was also able to make the FormatCurrency change suggested earlier by
using Notepad and saving it. That works, but only if you don't ever open
the file in FP again as it overwrites everything once again. Damn webbots!
 
D

David Berry

Beginning ASP Databases by Wrox is an excellent one. That's the one I used
the most while learning.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top