The following list of DoCmd methods shows the
commonly used commands. The general format for the command is Docmd.Action.
There are often one or more options to these action methods. The method examples & definitions on the
coding example pages are
paraphrased from Access help for clarity and additional code examples have been
added.
|
Example Page |
Example Description |
|
DoCmd Add Menu |
The AddMenu command example demonstrates how to
add an item to customized dropdown menus at the top of the Microsoft Access
database screen. |
|
DoCmd
Apply Filter |
These examples employ the Docmd.ApplyFilter method to display only
records that contain the state MD in the State field. |
|
DoCmd
Cancel Event |
The Cancel Event method quits
the event that caused Microsoft Access to run the code containing this
action. All further execution of the event is aborted. |
|
DoCmd Close |
The Access Close method carries out the Close
action in Visual Basic to close a form, report, or query in the running
database. |
|
DoCmd
Copy Object |
Docmd.CopyObject allows you to duplicate any database
object. |
|
DoCmd
Delete Object |
The DoCmd DeleteObject method performs a delete
operation on Access's objects such as tables, queries, forms and reports. |
|
DoCmd
Find Record |
The Access DoCmd.FindRecord method performs the Find Record action in Visual
Basic. This command is often used in conjunction with the
Docmd.FindNext to automate
searching for datasheet records based on user input. |
|
DoCmd Find Next |
Find the next record that meets the criteria
specified by the previous FindRecord action or the Find In Field dialog box. |
|
DoCmd Goto Control |
Move the focus to the indicated field or control
in the current record of the open form, datasheet, table datasheet, or query
datasheet. |
|
DoCmd Hour Glass |
Change the mouse pointer to an hourglass icon (or
another icon of your choice) while program is running. This method is used when
running a procedure from VBA that takes a while to run. |
|
DoCmd Min/Max/Restore |
Restores a database window object that has been
maximized or minimized to its previous size. |
|
DoCmd Open Form |
Open in Form view, datasheet, print preview, or
design view |
|
DoCmd Open Query |
Open a select or crosstab query in design,
datasheet, or print preview. Or, execute an action query from VBA script |
|
DoCmd Open Report |
Open a report in design or print preview, or to
print the report directly to the default printer. |
|
DoCmd Output To |
Output data in the current database (a datasheet,
form, report, module, DAP) to a file in Excel, DOS text (*.txt), or rich-text
format. |
|
DoCmd Run SQL |
Run an SQL action query by using the SQL command.
You may also run a
DDL query |
|
DoCmd Send Object |
Include the specified datasheet, form, report,
module, or data access page in an e-mail message - there it can be viewed and
sent. |
|
DoCmd Transfer Text |
The TransferText method sends/receives records from/to the database or project
and a file on your hard drive. The transfertext method may also be employed to
establish data table links between databases. |
|
TransferDatabase |
Import or export data from/to the current database (.mdb) or project (.adp)
and other databases such as FoxPro, dBase, and ODBC databases. |