As its name implies, this object allows you to do things within Microsoft Access. There are no properties of the DoCmd object, but there are a variety of methods you can utilize within your Access application.
The methods of the DoCmd object are listed in the following table. All of the methods here actually carry out an action with the same name as the method. We've included the description of the action, rather than the description of the method (which merely calls the action).
Method | Arguments | Description |
---|---|---|
AddMenu | MenuName, MacroName, StatusBarText | Creates a custom menu bar, shortcut bar, or shortcut menu |
ApplyFilter | FilterName, WhereCondition | Used to apply a filter, a query, or a SQL WHERE clause to a table, form, or report |
Beep | None | Causes the system to beep |
CancelEvent | None | Used to cancel the event that caused Access to run the macro or module containing this action |
Close | ObjectType, ObjectName, Save | Closes the object specified in the ObjectName argument |
CopyDatabaseFile | DatabaseFileName, OverwriteExistingFile, DisconnectAllUsers | Copies the database connected to the current project to a SQL Server database for export |
CopyObject | DestinationDatabase, NewName, SourceObjectType, SourceObjectName | Copies the specified object to another database (mdb) or Access project (adp) |
DeleteObject | ObjecType, ObjectName | Deletes the specified object |
DoMenuItem | MenuBar, MenuName, Command, SubCommand, Version | Executes the specified menu item (Note: This is a legacy method from Access 97. In later versions of Access this method was replaced by the RunCommand method. It is only included for backwards compatibility) |
Echo | EchoOn, StatusBarText | Turns Echo on or off |
FindNext | None | Finds the next record that meets the criteria specified in the FindRecord action |
FindRecord | FindWhat, Match, MatchCase, Search, SearchAsFormatted, OnlyCurrentField, FindFirst | Finds the first instance of a record that meets the criteria specified by the FindWhat argument |
GoToControl | ControlName | Moves focus to the specified control |
GoToPage | PageNumber, Right, Down | Moves the focus in a form to the first control on the specified page |
GoToRecord | ObjectType, ObjectName, Record, Offset | Makes the specified record the current record in a table, form, or result set |
Hourglass | HourglassOn | Changes the mouse pointer to an hourglass while the macro or code is running |
Maximize | None | Maximizes the entire Access Application window |
Minimize | None | Minimizes the entire Access Application window |
MoveSize | Right, Down, Width, Height | Moves or resizes the active window |
OpenDataAccessPage | DataAccessPageName, View | Opens the specified data access page in the specified view |
OpenDiagram | DiagramName | Opens the specified database diagram in design view |
OpenForm | FormName, View, FilterName, WhereCondition, DataMode, WindowMode, OpenArgs | Opens the specified form in the specified view. Can also be used to filter the data displayed on the form |
OpenFunction | FunctionName, View, DataMode | Opens a user-defined function in SQL Server for viewing in Access |
OpenModule | ModuleName, ProcedureName | Opens the specified module at the specified procedure |
OpenQuery | QueryName, View, DataMode | Opens the specified query with the specified type of view |
OpenReport | ReportName, View, FilterName, WhereCondition, WindowMode, OpenArgs | Opens the specified report in the specified view. Can also be used to filter the data displayed on the report |
OpenStoredProcedure | ProcedureName, View, DataMode | Used to open the specified stored procedure |
OpenTable | TableName, View, DataMode | Used to open the specified table in the specified view |
OpenView | ViewName, View, DataMode | Opens the specified view in datasheet view, design view, or print preview |
OutputTo | ObjectType, ObjectName, OutputFormat, OutputFile, AutoStart, TemplateFile, Encoding | Outputs the specified object in the specified file format |
PrintOut | PrintRange, PageFrom, PageTo, PrintQuality, Copies, CollateCopies | Prints the active object |
Quit | Options | Quits the active Access application |
Rename | NewName, ObjectType, OldName | Renames the specified object |
RepaintObject | ObjectType, ObjectName | Completes any pending screen updates for the specified object |
Requery | ControlName | Updates the data in the specified control by requerying the source of the control |
Restore | None | Restores a maximized or minimized window to its previous state |
RunCommand | Command | Runs a built-in menu or toolbar command (see RunCommand Method Arguments later in this appendix for command options) |
RunMacro | MacroName, RepeatCount, RepeatExpression | Used to run the specified macro |
RunSQL | SQLStatement, UseTransaction | Runs an Access action query by using the corresponding SQL statement |
Save | ObjectType, ObjectName | Saves the specified object |
SelectObject | ObjectType, ObjectName, InDatabaseWindow | Selects the specified database object |
SendObject | ObjectType, ObjectName, OutputFormat, To, Cc, Bcc, Subject, MessageText, EditMessage, TemplateFile | Sends the specified Access datasheet, form, report, module, or data access page via e-mail |
SetMenuItem | MenuIndex, CommandIndex, SubCommandIndex, Flag | Enable, disable, check, or uncheck the specified menu item |
SetWarnings | WarningsOn | Turns system messages on or off |
ShowAllRecords | None | Removes any applied filter for the table, query, or form |
ShowToolbar | ToolbarName, Show | Display or hide a built-in toolbar |
TransferDatabase | TransferType, DatabaseType, DatabaseName, ObjectType, Source, Destination, StructureOnly, StoreLogin | Used to import or export data between the current database (mdb) or Access project (adp) and another database |
TransferSpreadsheet | TransferType, SpreadsheetType, TableName, FileName, HasFieldNames, Range, UseOA | Used to import or export data between the current database (mdb) or Access project (adp) and a spreadsheet |
TransferSQLDatabase | Server, Database, UsedTrustedConnection, Login, Password, TransferCopyData | Transfers the entire SQL Server database to another SQL Server database |
TransferText | TransferType, SpecificationName, TableName, FileName, HasFieldNames, HTMLTableName, CodePage | Used to import or export data between a database (mdb) or Access project (adp) and a text file |
3.138.105.124