I would like to use a select statement to select a group of records and then display the sum of those records... I am currently using the following code, but only get the value of the first record, not the sum, does anyone know how to get the sum of records in a recordset? (varactual should refelct the sum) THANKS IN ADVANCE
varprojectid = Me.PONumber & "00"
stractual = "SELECT DrAmt FROM dbo_GLTran Where ProjectID = " & varprojectid & "AND TaskId Like '%Ocean Freight%'"
Set DbI = CurrentDb
Set qdfI = Db.CreateQueryDef("", stractual)
Set rstI = qdf2.OpenRecordset(dbOpenSnapshot)
If rst1.RecordCount > 0 Then
varactual = RTrim(rst1.Fields("Percentage"
.Value)
Else
End If
varprojectid = Me.PONumber & "00"
stractual = "SELECT DrAmt FROM dbo_GLTran Where ProjectID = " & varprojectid & "AND TaskId Like '%Ocean Freight%'"
Set DbI = CurrentDb
Set qdfI = Db.CreateQueryDef("", stractual)
Set rstI = qdf2.OpenRecordset(dbOpenSnapshot)
If rst1.RecordCount > 0 Then
varactual = RTrim(rst1.Fields("Percentage"
Else
End If