Re: loop through rows on a continuos form

Tech-Archive recommends: Speed Up your PC by fixing your registry



That code makes no attempt to loop through records, it's
only trying to loop through the controls in a subform's
current record.

right.
i need to go from there and loop through the records.


While that code is archaic, I think Access will still
process it as intended.


sure it works.
is there a better way?

If you really want to loop through the records in a form
(subform?), how you do it depends on what you are trying to
accomplish.


i need to loop through the values on the continuous subform's records to
compare them to what is already in another existing table.


OK, it sounds like you are not trying to scroll the records,
so Jen is right about using the subform's RecordsetClone.

If the code is in the main form's module, then I think this
aircode should give you the general idea of how to loop
through thesubform's records and their fields:

If ctlCntrl.ControlType = acSubForm Then
With ctlCntrl.Form.RecordstClone
If .RecordCount > 0 Then .MoveFirst
Look at each record in the form's dataset
Do Until .EOF
Look at each field in the record
For Each fld In ctlCntrl.Form.Fields
Debug.Print fld.Name, fld.Value
Next fld
.MoveNext
Loop
End With
End If

Be sure to check Help for anything in the above that you are
not familiar with.


thanks, i will try that on monday.
that is kind of the direction i was heading, but couldn't figure out syntax
for recordsetclone with all the abstraction.


.



Relevant Pages

  • RE: Jump to specific record in recordset
    ... the outer Do Loop, I always return to the first record of the inner recordset ... For Each fld In tdf.Fields ... Set rsCurrent = MyDB.OpenRecordset("SELECT * FROM qryOrderProductsBase ...
    (microsoft.public.access.modulesdaovba)
  • Re: Count VB
    ... >Your code doesn't loop through the field names, ... > Dim fld As DAO.Field ... >> Function CountBlanks(FiledName As String, ...
    (microsoft.public.access.modulesdaovba)
  • Re: FastCode : Exponential
    ... the number of loop changes the precision of the calculation. ... FLD Value ... FSTP ST ...
    (borland.public.delphi.language.basm)
  • Re: Veiwing Datasets in Debug Mode
    ... Chris Hanscom - Microsoft MVP ... Loop through the rs and print each fld, ... >> Is there a way to view the contents of a Dataset in Debug mode? ...
    (microsoft.public.vb.bugs)
  • Re: loop through rows on a continuos form
    ... mcnewsxp wrote: ... only trying to loop through the controls in a subform's ... i need to go from there and loop through the records. ... For Each fld In ctlCntrl.Form.Fields ...
    (microsoft.public.access.formscoding)