boblarson
Smeghead
- Local time
- Today, 04:13
- Joined
- Jan 12, 2001
- Messages
- 32,053
Okay - fixed:
Your problem was you weren't opening your recordset correctly.
Code:
Public Function CumulativeNumbers()
Dim cnn As ADODB.Connection
Dim rs As New ADODB.Recordset
Set cnn = CurrentProject.Connection
rs.Open "SELECT * FROM Temp1", cnn, adOpenDynamic, adLockOptimistic
cum = 0
While Not rs.EOF()
cum = cum + rs!Lines
fk = rs!Fake
rs.Fields("CumulateLines").Value = cum
rs.Update
rs.MoveNext
Wend
rs.Close
Set rs = Nothing
cnn.Close
Set cnn = Nothing
MsgBox ("Done!")
End Function
Your problem was you weren't opening your recordset correctly.