For what end?
The domain aggregate functions give you basic statistical info, e.g.:
DAvg(), DCount(), DLookup(), DMin(), DMax(), DStDev(), DSum(), DVar().
You can also sum or average the values into controls in the Form Footer
section of the subform. Use a Continuous View subform to show the results.
If you are trying to alter all related values, you could execute an Update
query, and then requery the subform. This example runs from the main form
where FK is the foreign key in the subform's table, and PK is the matching
numeric primary key in the main form:
Dim strSql As String
strSql = "UPDATE MySubformTable SET IsPicked = False WHERE (FK = " &
Me.PK & ") AND (IsPicked = True);"
dbEngine(0)(0).Execute strSql, dbFailOnError
Me.[NameOfYourSubformControlHere].Requery
If you need to loop through the records anyway, you can use the
RecordsetClone of the subform. If the subform is filtered, the clone set
will also be filtered, so may not give full results.
The code from the main form would look something like this:
With Me.[NameOfYourSubformControlHere].Form.RecordsetClone
If .RecordCount > 0 Then
.MoveFirst
Do While Not .EOF
'do something here.
.MoveNext
Loop
End If
End Sub
--
Allen Browne - Microsoft MVP. Perth, Western Australia.
Reply to group, rather than allenbrowne at mvps dot org.
S Kahn said:
I have a form (frmMain) with a subform (sfLabValues). In the subform I
enter
lab values on different dates.
What are my options to review the Lab results i.e how to navigate through
the records in the subform? Any ideas would be greatly appreciated. Thanks
S Kahn
PS: Pls be aware that my programming skills are rather limited!