First the code:
Do while Not objRS.EOF
If Count=1 Then
ResValue=objRs.Fields("ResTime"
.Value
ResCount=ResCount+Resvalue
End if
iRecordCount=iRecordCount+1
objRS.MoveNext
Loop
What I am attempting to do is loop through my database extracting the value for ResTime for each record, and adding the new value to the existing value so at the end I end up with a total figure.
BUT I CAN'T GET THIS TO WORK.
It just seems to concanenate the variable so if record 1=12 when it runs through to record 2, which say has a value of 15, it gives you 1215 instead of the sum of the two values, i.e. 27.
I'm sure it's something simple but can't work it out
Do while Not objRS.EOF
If Count=1 Then
ResValue=objRs.Fields("ResTime"
ResCount=ResCount+Resvalue
End if
iRecordCount=iRecordCount+1
objRS.MoveNext
Loop
What I am attempting to do is loop through my database extracting the value for ResTime for each record, and adding the new value to the existing value so at the end I end up with a total figure.
BUT I CAN'T GET THIS TO WORK.
It just seems to concanenate the variable so if record 1=12 when it runs through to record 2, which say has a value of 15, it gives you 1215 instead of the sum of the two values, i.e. 27.
I'm sure it's something simple but can't work it out