goto next record in a datasheet

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi guys

I am trying to create a subroutine that will loop through a recordset of
items and add them to a new record in a subform in datasheet mode. However,
I cannot seem to get the action to goto the next record. It "cannot go to
specified record" if I use:

DoCmd.GoToRecord , , acNewRec

Here is my code:

Do While Not rsItemGroups.EOF

DoCmd.GoToRecord , , acNewRec

Me.Item = Nz(rsItemGroups!ListID)
Me.Quantity = rsItemGroups!Quantity

I tried using a recordset clone to move to the next record, addnew and
update, however, I have a combo box that sets some of the fields as well as
some event handlers that dont seem to work with this method.

Any suggestions?

Thanks
David
 
Additional info:

The procedure is in a fields AfterUpdate event.

I tried:
DoCmd.GoToRecord acDataForm, me.Name, acNewRec

this gave me an error:

The object "subform" is not opened
 
Additional info:

The procedure is in a fields AfterUpdate event.

I tried:
DoCmd.GoToRecord acDataForm, me.Name, acNewRec

this gave me an error:

The object "subform" is not opened

A Subform is not open in its own right, only as part of the containing
form.

Try:

Me.subformname.SetFocus
Me.subformname.SomeControl.SetFocus
DoCmd.GoToRecord, , acNewRecord

John W. Vinson[MVP]
 
Hi John,

Thanks for responding
I tried your method and received error:
"Invalid method in an expression"

Also, the event handler is in the subform, not the main form.

So, i tried me.setfocus instead.

But that did not work.

What I want to do is when a user selects a "group" item in subdatasheet item
combo box
I tried Recordset clone but,I have some event handlers that are tied to
the fields so, the recordset clone thing does not handle this

it sounded easy in my mind....

Dp
 
Back
Top