Subform RecordSet

S

Steven

I have a form with a 2 subforms: Names: MainForm ; SubForm1 ; SubForm2

If I am on a record in SubForm1, how can I move to SubForm2 and move to the
next record in SubForm2 if there is a next record. And do it with code.

Thank you for your help,

Steven
 
A

Allen Browne

1. Save any edits in the current SubForm1.

2. Make SubForm2 the active control on the main form.

3. If it's not already at a new record, set focus to the desired control in
Subform2, and MoveNext in its Recodset.

Untested aircode, but this kind of thing:

If Me.Dirty Then Me.Dirty = False
Me.Parent!SubForm2.SetFocus
With Me.Parent!Subform2.Form
If Not .NewRecord Then
![SomeControl].SetFocus
If .Recordset.RecordCount > 0 Then
.Recordset.MoveNext
End If
End If
End With

Add error handling.
 

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