MyTetra Share
Делитесь знаниями!
DoCmd Object [Access 2003 VBA Language Reference]
16.03.2019
23:43
Текстовые метки: DoCmd,access
Раздел: !Закладки - VBA - Access - Link

DoCmd Object [Access 2003 VBA Language Reference]

Office 2003


Application
DoCmd

You can use the methods of the DoCmd object to run Microsoft Access actions from Visual Basic. An action performs tasks such as closing windows, opening forms, and setting the value of controls.

Using the DoCmd Object

For example, you can use the OpenForm method of the DoCmd object to open a form, or use the Hourglass method to change the mouse pointer to an hourglass icon.

Most of the methods of the DoCmd object have arguments — some are required, while others are optional. If you omit optional arguments, the arguments assume the default values for the particular method. For example, the OpenForm method uses seven arguments, but only the first argument, FormName, is required. The following example shows how you can open the Employees form in the current database. Only employees with the title Sales Representative are included.

DoCmd.OpenForm "Employees", , ,"[Title] = 'Sales Representative'"

The DoCmd object doesn't support methods corresponding to the following actions:

  • AddMenu.
  • MsgBox. Use the MsgBox function.
  • RunApp. Use the Shell function to run another application.
  • RunCode. Run the function directly in Visual Basic.
  • SendKeys. Use the SendKeys statement.
  • SetValue. Set the value directly in Visual Basic.
  • StopAllMacros.
  • StopMacro.

For more information on the Microsoft Access action corresponding to a DoCmd method, search the Help index for the name of the action.

The following example opens a form in Form view and moves to a new record.

Sub ShowNewRecord()

DoCmd.OpenForm "Employees", acNormal

DoCmd.GoToRecord , , acNewRec

End Sub



Methods | AddMenu Method | ApplyFilter Method | Beep Method | CancelEvent Method | Close Method | CopyDatabaseFile Method | CopyObject Method | DeleteObject Method | DoMenuItem Method | Echo Method | FindNext Method | FindRecord Method | GoToControl Method | GoToPage Method | GoToRecord Method | Hourglass Method | Maximize Method | Minimize Method | MoveSize Method | OpenDataAccessPage Method | OpenDiagram Method | OpenForm Method | OpenFunction Method | OpenModule Method | OpenQuery Method | OpenReport Method | OpenStoredProcedure Method | OpenTable Method | OpenView Method | OutputTo Method | PrintOut Method | Quit Method | Rename Method | RepaintObject Method | Requery Method | Restore Method | RunCommand Method | RunMacro Method | RunSQL Method | Save Method | SelectObject Method | SendObject Method | SetMenuItem Method | SetWarnings Method | ShowAllRecords Method | ShowToolbar Method | TransferDatabase Method | TransferSpreadsheet Method | TransferSQLDatabase Method | TransferText Method

Parent Objects | Application Object

Child Objects

See Also | Application Object

Так же в этом разделе:
 
MyTetra Share v.0.52
Яндекс индекс цитирования