Tricks of the Microsoft Office Gurus

To close this chapter, Table 13.10 presents a complete list of the macro actions you can use.

Table 13.10. Macro Actions and Their Descriptions

Action

Description

AddMenu

Replaces a built-in menu bar for a form or report with a custom menubar; replaces a built-in shortcut menu for a form, report, or form control with a custom shortcut menu.

ApplyFilter

Uses a filter, query, or SQL WHERE clause to restrict and/or sort the records in a form or report.

Beep

Beeps the computer's speakers.

CancelEvent

Cancels the event that caused the macro to run.

Close

Closes the active window or a specified window.

CopyDatabaseFile

Makes a copy of the current Access database file.

CopyObject

Copies a database object to another database or to the current database with a different name.

DeleteObject

Deletes a specified database object or the selected object in the database window.

Echo

Hides or shows the macro's actions while it runs.

FindNext

Finds the next record that meets the criteria used in the most recent FindRecord action or Find dialog box usage.

FindRecord

Finds the first record in a table or form that meets the specified criteria.

GoToControl

Moves the focus to the specified field or control on the current datasheet or form.

GoToPage

Moves the focus to the first field or control on the specified page in the active form.

GoToRecord

Makes the specified record the current record in a table, query result, or form.

Hourglass

Changes the mouse pointer from the normal icon to an hourglass icon; the pointer is restored when the macro stops.

Maximize

Enlarges the active window to fill the Access window.

Minimize

Reduces the active window to a title bar at the bottom of the Access window.

MoveSize

Moves or resizes the active window.

MsgBox

Displays a message to the user.

OpenDataAccessPage

Opens a specified data access page.

OpenDiagram

Opens a specified database diagram.

OpenForm

Opens a specified form.

OpenFunction

Opens a specified function.

OpenModule

Opens a specified Visual Basic module at a specified procedure or function.

OpenQuery

Opens a specified query.

OpenReport

Opens a specified report.

OpenStoredProcedure

Opens a specified stored procedure.

OpenTable

Opens a specified table.

OpenView

Opens a specified view.

OutputTo

Exports data from a database object to a file in another format, such as HTML, Excel, or text.

PrintOut

Prints the active datasheet, form, report, data access page, or module.

Quit

Shuts down Access.

Rename

Renames the specified database object.

RepaintObject

Completes any pending screen updates or control recalculations for the specified database object.

Requery

Updates data in the specified control in the active database object.

Restore

Restores a maximized or minimized window to its original location and size.

RunApp

Runs the specified application.

RunCode

Runs the specified VBA function. (To run a procedure, create a function that calls the procedure and then use RunCode to run the function.)

RunCommand

Runs the specified command in a built-in menu or toolbar.

RunMacro

Runs the specified Access macro.

RunSQL

Runs the specified SQL statement for an action or data definition query.

Save

Saves the specified database object.

SelectObject

Selects the specified database object.

SendKeys

Sends one or more keystrokes to Access or the active application.

SendObject

Includes the specified database object in an email message.

SetMenuItem

Sets the state of menu items (such as checked or unchecked) on the custom or global menu bar for the active window.

SetValue

Sets the value of a field, control, or property on a form or report.

SetWarnings

Turns system messages on or off.

ShowAllRecords

Removes any applied filter from the active table, query, or form.

ShowToolbar

Displays or hides a built-in or custom toolbar.

StopAllMacros

Stops all currently running macros.

StopMacro

Stops the currently running macro.

transferDatabase

Imports, exports, or links data between the current Access database and another database.

TRansferSpreadsheet

Imports, exports, or links data between the current Access database and a spreadsheet file.

transferSQLDatabase

Transfers an SQL database from one server to a SQL database on another server.

TRansferText

Imports, exports, or links data between the current Access database and a text file.

From Here

  • For more information on using calculated text boxes in reports, see the section titled "Adding Calculations to a Report" in Chapter 4.

  • VBA can do everything Access macros can do, and much more. To learn VBA basics, see Chapter 11, "Maximizing Office with VBA Macros."

  • The strings used in the SendKeys action's Keystroke argument are identical to those used with the OnKey method in Excel VBA. In Chapter 12, see the section titled "Assigning Shortcut Keys to Excel Macros."

Категории