Close a form, report or window.
Syntax DoCmd.Close(ObjectType, ObjectName, Save) Key ObjectType An AcObjectType constant that represents the type of object to close. ObjectName A string expression that's the valid name of an object of the type selected by the objecttype argument. Save Whether or not to save changes to the object: acSavePrompt (0)
The Close method can be used to close either a specified Access window or the active window (if ObjectType and ObjectName are left blank).
The Save options will save any design changes that have been made to the form/report, this option does not save the record data.
If a form is closed without first saving the record, Access will attempt to save the record but this can fail - if a required field is missing any changes made to the record will be aborted and no error will be displayed.
A good practice is to use RunCommand acCmdSaveRecord immediately before calling .Close. This will cause a run-time error if one or more required fields are Null. This is illustrated in the following example.
'Save the current record and close the current window
On Error GoTo Err_handler
'Close the form frmPatientDetails, without saving the form
DoCmd.Close acForm, "frmPatientDetails", acSaveNo
'Close the active object, without saving
DoCmd.Close , , acSaveNo
“A good opening and a good ending make for a good film provide they come close together” ~ Federico Fellini
Maximize - Enlarge the active window.
Minimize - Minimise a window.
RecordSet.Close - Close a recordset