M
Martin Williams
I'm trying to cycle through the child records of a current customer, in
order to calculate a total. Here is my code so far:
sub GetTransactionTotal()
dim drArray() as datarow
dim intCount, intCurrentCustomer as integer
dim dblSubTotal, dblTax, dblTotal as double
intCurrentCustomer = me.bindingcontext(dataset1, "Customer").position + 1
drArray = dataset1.customer(intCurrentCustomer).GetChildRows("DataRelation")
for intCount = 0 to drArray.GetUpperBound(0)
if drArray(intCount).item("Date Rented") = today.toshortdatestring then
dblSubTotal += drArray(intCount).item("Price")
else
exit for
end if
next
dblTax = dblSubtotal * .06
dblTotal = dblSubtotal + dblTax
txtSubtotal.text = dblSubtotal.tostring("c")
txtTax.text = dblTax.tostring("c")
txtTotal.text = dblTotal.tostring("c")
end sub
Basically, it's not doing anything. All I get is "$0.00". Thanks for all
responses.
Regards,
Martin Williams
order to calculate a total. Here is my code so far:
sub GetTransactionTotal()
dim drArray() as datarow
dim intCount, intCurrentCustomer as integer
dim dblSubTotal, dblTax, dblTotal as double
intCurrentCustomer = me.bindingcontext(dataset1, "Customer").position + 1
drArray = dataset1.customer(intCurrentCustomer).GetChildRows("DataRelation")
for intCount = 0 to drArray.GetUpperBound(0)
if drArray(intCount).item("Date Rented") = today.toshortdatestring then
dblSubTotal += drArray(intCount).item("Price")
else
exit for
end if
next
dblTax = dblSubtotal * .06
dblTotal = dblSubtotal + dblTax
txtSubtotal.text = dblSubtotal.tostring("c")
txtTax.text = dblTax.tostring("c")
txtTotal.text = dblTotal.tostring("c")
end sub
Basically, it's not doing anything. All I get is "$0.00". Thanks for all
responses.
Regards,
Martin Williams