enumerating subform in continuous mode

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
 
N

Neil

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.
 
R

Rod Scoullar

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top