1

I would like to pass a value and add to it with the previous value thats what I want.. The below code doesn't work...I can't understand the problem.. Actually its for rdlc - total purpose I need it. My Code

public MyValue as Decimal=0
public Function AddToSum(ByVal quantity as Decimal) as Decimal
MyValue=AddToSum+quantity
AddToSum=MyValue
return AddToSum
End Function 

Suppose I have a Table field bill_amt 

bill_amt   AddToSum(bill_Amt) should be like the below
15             15
25             40
35             75

Is it possible?

rene
  • 41,474
  • 78
  • 114
  • 152
LOGAN
  • 35
  • 1
  • 6

2 Answers2

1

@Logan you don't need to write a function for that purpose . A RunningValue() function can be used to generate the AddToSum(bill_Amt). e.g.RunningValue(Fields!bill_amt.Value,Sum,"Group or DataSet Name")

1

Not sure what you tried to do with your sample code, but you can simply do this:

Public MyValue as Decimal = 0
Public Function AddToSum(ByVal quantity as Decimal) as Decimal
  MyValue = quantity + MyValue
  Return MyValue
End Function
Meta-Knight
  • 17,626
  • 1
  • 48
  • 58