E.13. The DoCmd Object

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.

E.13.1. Methods of the DoCmd Object

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).

MethodArgumentsDescription
AddMenuMenuName, MacroName, StatusBarTextCreates a custom menu bar, shortcut bar, or shortcut menu
ApplyFilterFilterName, WhereConditionUsed to apply a filter, a query, or a SQL WHERE clause to a table, form, or report
BeepNoneCauses the system to beep
CancelEventNoneUsed to cancel the event that caused Access to run the macro or module containing this action
CloseObjectType, ObjectName, SaveCloses the object specified in the ObjectName argument
CopyDatabaseFileDatabaseFileName, OverwriteExistingFile, DisconnectAllUsersCopies the database connected to the current project to a SQL Server database for export
CopyObjectDestinationDatabase, NewName, SourceObjectType, SourceObjectNameCopies the specified object to another database (mdb) or Access project (adp)
DeleteObjectObjecType, ObjectNameDeletes the specified object
DoMenuItemMenuBar, MenuName, Command, SubCommand, VersionExecutes 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)
EchoEchoOn, StatusBarTextTurns Echo on or off
FindNextNoneFinds the next record that meets the criteria specified in the FindRecord action
FindRecordFindWhat, Match, MatchCase, Search, SearchAsFormatted, OnlyCurrentField, FindFirstFinds the first instance of a record that meets the criteria specified by the FindWhat argument
GoToControlControlNameMoves focus to the specified control
GoToPagePageNumber, Right, DownMoves the focus in a form to the first control on the specified page
GoToRecordObjectType, ObjectName, Record, OffsetMakes the specified record the current record in a table, form, or result set
HourglassHourglassOnChanges the mouse pointer to an hourglass while the macro or code is running
MaximizeNoneMaximizes the entire Access Application window
MinimizeNoneMinimizes the entire Access Application window
MoveSizeRight, Down, Width, HeightMoves or resizes the active window
OpenDataAccessPageDataAccessPageName, ViewOpens the specified data access page in the specified view
OpenDiagramDiagramNameOpens the specified database diagram in design view
OpenFormFormName, View, FilterName, WhereCondition, DataMode, WindowMode, OpenArgsOpens the specified form in the specified view. Can also be used to filter the data displayed on the form
OpenFunctionFunctionName, View, DataModeOpens a user-defined function in SQL Server for viewing in Access
OpenModuleModuleName, ProcedureNameOpens the specified module at the specified procedure
OpenQueryQueryName, View, DataModeOpens the specified query with the specified type of view
OpenReportReportName, View, FilterName, WhereCondition, WindowMode, OpenArgsOpens the specified report in the specified view. Can also be used to filter the data displayed on the report
OpenStoredProcedureProcedureName, View, DataModeUsed to open the specified stored procedure
OpenTableTableName, View, DataModeUsed to open the specified table in the specified view
OpenViewViewName, View, DataModeOpens the specified view in datasheet view, design view, or print preview
OutputToObjectType, ObjectName, OutputFormat, OutputFile, AutoStart, TemplateFile, EncodingOutputs the specified object in the specified file format
PrintOutPrintRange, PageFrom, PageTo, PrintQuality, Copies, CollateCopiesPrints the active object
QuitOptionsQuits the active Access application
RenameNewName, ObjectType, OldNameRenames the specified object
RepaintObjectObjectType, ObjectNameCompletes any pending screen updates for the specified object
RequeryControlNameUpdates the data in the specified control by requerying the source of the control
RestoreNoneRestores a maximized or minimized window to its previous state
RunCommandCommandRuns a built-in menu or toolbar command (see RunCommand Method Arguments later in this appendix for command options)
RunMacroMacroName, RepeatCount, RepeatExpressionUsed to run the specified macro
RunSQLSQLStatement, UseTransactionRuns an Access action query by using the corresponding SQL statement
SaveObjectType, ObjectNameSaves the specified object
SelectObjectObjectType, ObjectName, InDatabaseWindowSelects the specified database object
SendObjectObjectType, ObjectName, OutputFormat, To, Cc, Bcc, Subject, MessageText, EditMessage, TemplateFileSends the specified Access datasheet, form, report, module, or data access page via e-mail
SetMenuItemMenuIndex, CommandIndex, SubCommandIndex, FlagEnable, disable, check, or uncheck the specified menu item
SetWarningsWarningsOnTurns system messages on or off
ShowAllRecordsNoneRemoves any applied filter for the table, query, or form
ShowToolbarToolbarName, ShowDisplay or hide a built-in toolbar
TransferDatabaseTransferType, DatabaseType, DatabaseName, ObjectType, Source, Destination, StructureOnly, StoreLoginUsed to import or export data between the current database (mdb) or Access project (adp) and another database
TransferSpreadsheetTransferType, SpreadsheetType, TableName, FileName, HasFieldNames, Range, UseOAUsed to import or export data between the current database (mdb) or Access project (adp) and a spreadsheet
TransferSQLDatabaseServer, Database, UsedTrustedConnection, Login, Password, TransferCopyDataTransfers the entire SQL Server database to another SQL Server database
TransferTextTransferType, SpecificationName, TableName, FileName, HasFieldNames, HTMLTableName, CodePageUsed to import or export data between a database (mdb) or Access project (adp) and a text file

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.138.105.124