"Lynx101" <ma**********@gmail.comwrote in message
news:cd**********************************@m36g2000 hse.googlegroups.com...
>I am trying to move a subform onto the next record with:
DoCmd.GoToRecord acForm, "MaintainAssets_edit", acNext
but when I do this I get "The object 'MaintainAssets_edit' is isn't
open". I know I could easily put the controls in the subform itself
but I want the record controls at the top of the page, outside of the
subform.
Thanks for looking.
Matt
Open the form MaintainAssets_edit in design view. Switch to the VB
environment and create a public procedure in the form's module:
Public Sub MoveToNext()
DoCmd.GoToRecord acForm, Me.Name, acNext
End Sub
Save the form, then in your main form, substitute the DoCmd line with:
Me.SubformControlName.Form.MoveToNext
Replace 'SubformControlName' with the name of the control housing the form
MaintainAssets_edit.
The procedure is visible to the main form because it is declared Public. The
code executes in the context of the subform.