For each?

1. Senior Member
Join Date
Dec 1969
Posts
228

## For each?

This code will provide a string to update a table entry for the subtotal field. But it only does so for the last row. There may be multiple rows containing a unitprice and quantity.<BR><BR>for y=1 to recordcount<BR>strSubtl =CDbl(request.form("unitprice"&y))*Cdbl(request.fo rm("quantity"&y))<BR>y=y+1<BR>next%&#062;<BR><BR>T his is related to something else I was asking about earlier, but it&#039s a separate problem.<BR>

2. Senior Member
Join Date
Dec 1969
Posts
226

## RE: For each?

shouldn&#039t it be<BR><BR>strSubtl =strSubtl & CDbl(request.form("unitprice"&y))*Cdbl(request.for m("quantity"&y))<BR>

3. MG Guest

## RE: For each?

for y=0 t recordcount<BR>strSubtl =CDbl(request.form("unitprice"&y))*Cdbl(request.fo rm("quantity"&y))<BR>next<BR><BR>you don&#039t need the y=y+1

4. IVAR Guest

## RE: For each?

hey dude concatinate the values into the variable (strSubtl) such that it holds all the values.<BR>e.g. strSubtl = strSubtl & .......<BR><BR>The current syntax as shwn will runn corectly but will hold the value for the last row as the earlier rows are being over-written.<BR><BR>for mutiple values its better if u use an array!!

5. Senior Member
Join Date
Dec 1969
Posts
228

## Thanks To you All!

But where is there a book with all this y=y+1 stuff.<BR><BR>I&#039ve got Learning VBscript and ASP Professinal, but I dont&#039 see it in there. I hate to keep bugging the message board to get this stuff.

#### Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts
•