Ali Edwards
Registered User.
- Local time
- Today, 23:42
- Joined
- Apr 19, 2001
- Messages
- 68
Hi - can anyone help with this one? It should be simple.......!
I have a mainform/ subform routine where I am trying to add the values of a control in all the subform's records and enter it in a field in the main form.
'subform name = Compilation_Form.
'memory = the field in the main form I wish to put the result in.
'TD = the field on each record (in the subform) whose value I am trying to take and add to the 'memory' field (in the main form), before moving to the next record and adding that value etc.
At the moment the 'memory' field will only show the value of the last record in the subform's recordset
'-------------------------
Dim memory As String
Dim rst As Recordset
'zero out the memory field to start
Me.memory = "0"
Set rst = Me.Compilation_Form.Form.Recordset
rst.MoveFirst
Do Until rst.EOF
Me.memory = Me.[Compilation_Form].Form![TD] + Me.memory.OldValue
rst.MoveNext
If Not rst.EOF Then
Me.Compilation_Form.Form.Bookmark = rst.Bookmark
End If
Loop
'--------------------------
I have a mainform/ subform routine where I am trying to add the values of a control in all the subform's records and enter it in a field in the main form.
'subform name = Compilation_Form.
'memory = the field in the main form I wish to put the result in.
'TD = the field on each record (in the subform) whose value I am trying to take and add to the 'memory' field (in the main form), before moving to the next record and adding that value etc.
At the moment the 'memory' field will only show the value of the last record in the subform's recordset
'-------------------------
Dim memory As String
Dim rst As Recordset
'zero out the memory field to start
Me.memory = "0"
Set rst = Me.Compilation_Form.Form.Recordset
rst.MoveFirst
Do Until rst.EOF
Me.memory = Me.[Compilation_Form].Form![TD] + Me.memory.OldValue
rst.MoveNext
If Not rst.EOF Then
Me.Compilation_Form.Form.Bookmark = rst.Bookmark
End If
Loop
'--------------------------