<SCRIPT LANGUAGE=vbscript RUNAT=Server>
function GetOrderTotalByCustomer(CustomerID)
dim lTotal
if len(CustomerID) > 0 then
sCustomerID = CustomerID
else
sCustomerID = CustomerdInformation.getCustomerID()
if len(sCustomerID) = 0 then
sCustomerID = Request("CustomerID")
end if
end if
if len(sCustomerID) > 0 then
rsOrdersByCustomerID.open
do while not rsOrdersByCustomerID.EOF
lTotal = lTotal +
rsOrdersByCustomerID.fields.getValue("LineItemTotal")
rsOrdersByCustomerID.moveNext
loop
end if
GetOrderTotalByCustomer = lTotal
end function
</SCRIPT>
<%
'Response.Write "Total orders are: " & GetOrderTotalByCustomer ("ANTON")
%>