selecting CurrentRecord in a subform

G

Guest

I want to advance the current record in a subform (in DataSheet view) when
the user clicks a button on the parent form. The name of the subform control
is "subfrmKitsFound2". If I use:

DoCmd.GoToRecord acDataForm, "subfrmKitsFound2", acNext

I just get the error:

The object 'subfrmKitsFound2' isn't open.

I get the same error if I instead use the name of the form upon which the
subform is based ("Kits Found subform sp").

Am I trying to do something that is unsupported by Access 2003?
 
G

George Nicholson

Subforms aren't considered to be open Forms, so you can't use GoToRecord,
which needs the name of an open form.

From the subform:
Me.Recordset.MoveNext

From the parent form (replacing NameOfSubFormControl with the name of the
Control, not the Form):
Me.NameOfSubformControl.Form.Recordset.MoveNext

HTH,
 
M

Marshall Barton

Allen_N said:
I want to advance the current record in a subform (in DataSheet view) when
the user clicks a button on the parent form. The name of the subform control
is "subfrmKitsFound2". If I use:

DoCmd.GoToRecord acDataForm, "subfrmKitsFound2", acNext

I just get the error:

The object 'subfrmKitsFound2' isn't open.

I get the same error if I instead use the name of the form upon which the
subform is based ("Kits Found subform sp").


Try this:

With Me.subfrmKitsFound2.Form.Recordset
If .AbsolutePostition < .RecordCount - 1 Then
.MoveNext
Else
'already at last record, what to do??
End If
End With
 

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