Forums

ASP

This topic is locked

Formatting a 'sub'

Posted 30 Sep 2001 14:37:20
1
has voted
30 Sep 2001 14:37:20 jon badda posted:
<BLOCKQUOTE id=quote><font size=1 face="Verdana, Arial, Helvetica" id=quote>quote:<hr height=1 noshade id=quote>
Before the Repeat Region you need to declare a variable and set it's value to zero.

&lt;%
DIM myTotal
myTotal = 0
%&gt;

And then IN the Repeat Region you should write the following code:

&lt;% myTotal = myTotal + rsName.Item.Fields(myField).Value %&gt;

And then in the table cell where you want to place the total

&lt;% =myTotal %&gt;

That should do the job.
<hr height=1 noshade id=quote></BLOCKQUOTE id=quote></font id=quote><font face="Verdana, Arial, Helvetica" size=2 id=quote>

I found the answer to the question below and it worked good BUT i really need to format it as a currency number.

im getting the same basic error about not being able to paranthesis a 'sub' but cant seem to make it go away.

This is what a formatted record looks like...

&lt;%= FormatCurrency((rsWhole.Fields.Item("productPrice".Value), -1, -2, -2, -2)
%&gt;

and i want the &lt;% =myTotal %&gt; to be formatted similarly.

Any help would be great, thanks.

Replies

Replied 30 Sep 2001 18:15:53
30 Sep 2001 18:15:53 Owen Eastwick replied:
Have you tried:

&lt;%= FormatCurrency(myTotal, -1, -2, -2, -2)%&gt;

Regards

Owen.

Multiple Parameter UD4 / Access 2000 Database Search Tutorial:
www.tdsf.co.uk/tdsfdemo
Replied 01 Oct 2001 13:53:13
01 Oct 2001 13:53:13 jon badda replied:
<BLOCKQUOTE id=quote><font size=1 face="Verdana, Arial, Helvetica" id=quote>quote:<hr height=1 noshade id=quote>
Have you tried:

&lt;%= FormatCurrency(myTotal, -1, -2, -2, -2)%&gt;

Regards

Owen.

Multiple Parameter UD4 / Access 2000 Database Search Tutorial:
www.tdsf.co.uk/tdsfdemo
<hr height=1 noshade id=quote></BLOCKQUOTE id=quote></font id=quote><font face="Verdana, Arial, Helvetica" size=2 id=quote>

absolutely marvellous.

I had played around with various incarnations of that...but I can see what i was doing wrong now.

thanks alot.

Reply to this topic