Hi
I have a table called Royalty with sumRoyalty field. I am trying to calculate the sum of all the royalties.
I am using the sum function to calculate the sum of all the royalties but it doesn't work. It just gets the first royalty number. Can you suggest what I am doing wrong and how I can fix it?
Thankyou.
dim cumRoyalty2, strSQL as string
dim rsCumSales as recordset
strSQL = "Select Sum(Royalty.sumRoyalty) as SumofROYALTY from Royalty;"
Set rsCumSales = db.OpenRecordset(strSQL, dbOpenDynaset)
If (Not rsCumSales.EOF) Then
If Not IsNull(rsCumSales!SumofROYALTY) Then
cumRoyalty2 = rsCumSales!SumofROYALTY
Else
cumRoyalty2 = 0
End If
Else
cumRoyalty2 = 0
End If
I have a table called Royalty with sumRoyalty field. I am trying to calculate the sum of all the royalties.
I am using the sum function to calculate the sum of all the royalties but it doesn't work. It just gets the first royalty number. Can you suggest what I am doing wrong and how I can fix it?
Thankyou.
dim cumRoyalty2, strSQL as string
dim rsCumSales as recordset
strSQL = "Select Sum(Royalty.sumRoyalty) as SumofROYALTY from Royalty;"
Set rsCumSales = db.OpenRecordset(strSQL, dbOpenDynaset)
If (Not rsCumSales.EOF) Then
If Not IsNull(rsCumSales!SumofROYALTY) Then
cumRoyalty2 = rsCumSales!SumofROYALTY
Else
cumRoyalty2 = 0
End If
Else
cumRoyalty2 = 0
End If