enumerating subform in continuous mode

  • Thread starter Thread starter Andy
  • Start date Start date
A

Andy

I need to step through each subform (single form with continuous form style
subform) on my form.
I have tried a number of way of stepping through each subform but I can only
appear to be able to access the first subform on every form.
Any ideas?
Thanks

Andy
 
Andy,

Do you mean you have a few subforms on a main form and want to loop through
the main form and find each one? If so, you could use something like the
following:

Dim ctl As Control
' Loop through all controls on the main form
For Each ctl In Me.Controls
' Check the type of control
If TypeOf ctl Is SubForm Then
' This is a subform
End If
Next

If the code is not in the main form then you would replace Me.Controls with
Forms!MyFormName.Controls.

HTH,

Neil.
 
Andy,

This code moves the moves the focus to the next 'record/form' (whatever it
should be called) in the list of continuous forms each time it is run.. I
tested it as the click event of a button, each time the button was clicked
the next instance was selected.

Hope it will be useful.

Rod Scoullar.

Private Sub Command38_Click()
Static varBkmk As Variant

If IsEmpty(varBkmk) Then
Me.RecordsetClone.MoveFirst
Else
Me.RecordsetClone.Bookmark = varBkmk
Me.RecordsetClone.MoveNext
End If
varBkmk = Me.RecordsetClone.Bookmark
Me.Recordset.Bookmark = varBkmk
End Sub
 
Back
Top