I am trying to create a total within a table that I am creating on the
fly, whereby an infinite amount of records can be added to this table.
Any suggestions or direction would be appreciated. I had tried the SUM
function in the total row but to no avail.
Here is the code I have developed in order to create the table:
'***** Setup the variable to ensure empty before populating. *****
strcustAllProducts = ""
'***** Build the Apologetic products table associated with this customer
and where user can add or delete product. *****
If Not rs.EOF Then
strfname = trim(rs("customer_fname"))
strlname = trim(rs("customer_lname"))
strAllProducts_table = "<TABLE width='575' align='left' border='1'
cellpadding='2' cellspacing='0'>"
strAllProducts_table = strAllProducts_table & "<tr>" & vbCRLF
strAllProducts_table = strAllProducts_table & "<th><font face='arial'
size='2'>Product:</font></th>" & vbCRLF
strAllProducts_table = strAllProducts_table & "<th><font face='arial'
size='2'>Qty.:</font></th>" & vbCRLF
strAllProducts_table = strAllProducts_table & "<th><font face='arial'
size='2'>Suggested Donation Amt.:</font></th>"
& vbCRLF
strAllProducts_table = strAllProducts_table & "</tr>" & vbCRLF
'***** Setup the variable to ensure empty before populating
strcustAllProducts = ""
'***** Start loop for all products associated with the customer_id. *****
Do While Not rs.EOF
strAllProducts_table = strAllProducts_table & "<tr>" & vbCRLF
strAllProducts_table = strAllProducts_table & "<td align='left'
valign='middle'><font face='arial' size='2' value='" & rs("product_id") & "'>" &
rs("product_description") & "</font></td>" & vbCRLF
strAllProducts_table = strAllProducts_table & "<td align='center'
valign='middle' value='" & rs("product_qty") & "'>" & rs("product_qty") & "</td>"
& vbCRLF
strAllProducts_table = strAllProducts_table & "<td align='right'
valign='middle' name='donation_amt'>" &
formatnumber(rs("product_qty") * rs("product_donation_amt"), 2) & "<br><br></td>" &
vbCRLF
strAllProducts_table = strAllProducts_table & "</tr>" & vbCRLF
'***** Set variable to a comma delimited string for using in the updated
stored procedure above. *****
strcustAllProducts = strcustAllProducts & rs("product_id") & ", "
rs.MoveNext
Loop
strAllProducts_table = strAllProducts_table & "<tr>" & vbCRLF
strAllProducts_table = strAllProducts_table & "<td align='left'
valign='middle'><font face='arial' size='2'>Total:</font></td>" & vbCRLF
strAllProducts_table = strAllProducts_table & "<td> </td>" & vbCRLF
strAllProducts_table = strAllProducts_table & "<td align='right'
valign='middle'>" &
sum(Request.Form("donation_amt")) & "</font></td>" & vbCRLF
strAllProducts_table = strAllProducts_table & "</tr>" & vbCRLF
strAllProducts_table = strAllProducts_table & "</table>" & vbCRLF
'***** Remove the comma at the end of the last record. *****
strcustAllProducts = left(strcustAllProducts, len(strcustAllProducts) -
2) & " "
End If
rs.Close
---
You are currently subscribed to activeserverpages as: [email protected]
To unsubscribe send a blank email to [EMAIL PROTECTED]