DoCmd.Save method (Access)
The Save method carries out the Save action in Visual Basic.
Syntax
expression.Save (ObjectType, ObjectName)
expression A variable that represents a DoCmd object.
Parameters
Name | Required/Optional | Data type | Description |
---|---|---|---|
ObjectType | Optional | AcObjectType | An AcObjectType constant that specifies the type of object that you want to save. |
ObjectName | Optional | Variant | A string expression that's the valid name of an object of the type selected by the ObjectType argument. |
Remarks
The Save method works on all database objects that the user can explicitly open and save. The specified object must be open for the Save method to have any effect on the object.
If you leave the ObjectType and ObjectName arguments blank (the default constant, acDefault, is assumed for the ObjectType argument), Microsoft Access saves the active object.
If you leave the ObjectType argument blank, but enter a name in the ObjectName argument, Access saves the active object with the specified name.
If you enter an object type in the ObjectType argument, you must enter an existing object's name in the ObjectName argument.
Note
You can't use the Save method to save any of the following with a new name:
- A form in Form view or Datasheet view
- A report in Print Preview
- A module
- A server view in Datasheet view or Print Preview
- A table in Datasheet view or Print Preview
- A query in Datasheet view or Print Preview
- A stored procedure in Datasheet view or Print Preview
Example
The following example uses the Save method to save the form named New Employees Form. This form must be open when the code containing this method runs.
DoCmd.Save acForm, "New Employees Form"
Support and feedback
Have questions or feedback about Office VBA or this documentation? Please see Office VBA support and feedback for guidance about the ways you can receive support and provide feedback.
피드백
https://aka.ms/ContentUserFeedback
출시 예정: 2024년 내내 콘텐츠에 대한 피드백 메커니즘으로 GitHub 문제를 단계적으로 폐지하고 이를 새로운 피드백 시스템으로 바꿀 예정입니다. 자세한 내용은 다음을 참조하세요.다음에 대한 사용자 의견 제출 및 보기