How can I "Save & GoTo New" in a sub form?

M

mamasonflowa

I have a main form with a subform in it. I want the end user to click the
"NextOrder" button to save and go to new blank record, when same end user is
entering multiple orders. The button is in the subform and works there but
not after I load the subform into main form. It gives me the following error.

The object NONAME isn't open
*The macro you are running (directly or indirectly) contains a GoToRecord,
RepaintObject, or SelectObject action, but the Object Name argument names an
object that is closed.
*The objectname argument for the GoToRecord, RepaintObject, or SelectObject
method names an object that is closed.
Use one of the Open action or methods to open the object so that you can
carry out the desired action.

Within the subform, that the NoName object (table) is not open and yet I
don't get the error.
 
A

Arvin Meyer [MVP]

Unless you are using unbound subforms, clicking "Save" is unnecessary. As
you leave a record, it is automatically saved. Just add a button which goes
to the new record (from the wizard):

Private Sub cmdNewRec_Click()
On Error GoTo Err_cmdNewRec_Click
DoCmd.GoToRecord , , acNewRec
Exit_cmdNewRec_Click:
Exit Sub
Err_cmdNewRec_Click:
MsgBox Err.Description
Resume Exit_cmdNewRec_Click
End Sub
 
M

mamasonflowa

Thank you Arvin, it work. Yippee for me.

Arvin Meyer said:
Unless you are using unbound subforms, clicking "Save" is unnecessary. As
you leave a record, it is automatically saved. Just add a button which goes
to the new record (from the wizard):

Private Sub cmdNewRec_Click()
On Error GoTo Err_cmdNewRec_Click
DoCmd.GoToRecord , , acNewRec
Exit_cmdNewRec_Click:
Exit Sub
Err_cmdNewRec_Click:
MsgBox Err.Description
Resume Exit_cmdNewRec_Click
End Sub
--
Arvin Meyer, MCP, MVP
http://www.datastrat.com
http://www.mvps.org/access
http://www.accessmvp.com





.
 
D

De Jager

mamasonflowa said:
I have a main form with a subform in it. I want the end user to click the
"NextOrder" button to save and go to new blank record, when same end user
is
entering multiple orders. The button is in the subform and works there but
not after I load the subform into main form. It gives me the following
error.

The object NONAME isn't open
*The macro you are running (directly or indirectly) contains a GoToRecord,
RepaintObject, or SelectObject action, but the Object Name argument names
an
object that is closed.
*The objectname argument for the GoToRecord, RepaintObject, or
SelectObject
method names an object that is closed.
Use one of the Open action or methods to open the object so that you can
carry out the desired action.

Within the subform, that the NoName object (table) is not open and yet I
don't get the error.
 

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