Autosave records without pop-up windows

Hello,
I am closing a form with the macro:

ThisDatabaseDocument.FormDocuments.getbyname("<Form Name>").close

But this launches the pop up window that asks to save the data. Is there a macro to autosave the records and avoid the pop up window?
Thanks

I would never do this. You couldn’t cancel it.
You will need the form for this macro, which should be part of your macro.

IF oForm.isNew THEN
oForm.insertRow()
ELSE
oForm.updateRow()
END IF

Thank you. What do you mean by “You couldn’t cancel it”?
Shall I use this macro?

Sub openFORM
	const sNewDocumentName="<New Form>"
	ThisDatabaseDocument.FormDocuments.getbyname("<Old Form>").close
    IF oForm.isNew THEN
       oForm.insertRow()
    ELSE
       oForm.updateRow()
    END IF
oNewFormDocument=ThisDatabaseDocument.FormDocuments.getbyname(sNewDocumentName).open
End Sub

If you will execute it the right way: Closing one form will save the content for this form. No possibility to cancel saving. If you didn’t notice you changed something it will be saved without any warning.

The code must be executed before the form has been closed. Your code is only for closing one form-document and opening another form-document. The code for saving the form will need the form, which is part of the form-document. If you are starting the macro by a button inside the form you want to close:

Sub openForm(oEvent AS OBJECT)
    oForm = oEvent.Source.Model.Parent
    IF oForm.isNew THEN
       oForm.insertRow()
    ELSE
       oForm.updateRow()
    END IF
    ThisDatabaseDocument.FormDocuments.getbyname("<Old Form>").close
    oNewFormDocument=ThisDatabaseDocument.FormDocuments.getbyname("<New Form>").open
End Sub

OK, I am not concerned about not canceling data: opening the next form assumes that one is sure about the data. Thanks

It worked as a charm. Thanks!