Microsoft Access defines a special object, DoCmd, that you use to carry out macro actions in Microsoft Visual Basic procedures. You carry out an action by adding a method of the DoCmd object to your procedure. Most actions have a corresponding DoCmd method.
DoCmd.method [arguments]
Method is the name of a method. Arguments are the method arguments, if there are any.
For example, to create a procedure that carries out the OpenForm action, add the OpenForm method of the DoCmd object to the procedure. The following method is equivalent to the OpenForm action; it opens the Add Products form:
DoCmd.OpenForm "Add Products"
A few actions don't have corresponding DoCmd methods, although some have equivalent Visual Basic statements or functions.
Macro actions that don't have a corresponding DoCmd event
Action Microsoft Visual Basic equivalent AddMenu No equivalent MsgBox MsgBox function RunApp Shell function RunCode Procedure call (Call statement) SendKeys SendKeys statement SetValue Assignment statement (Let statement) StopAllMacros Stop or End statements StopMacro Exit Sub or Exit Function statements