Microsoft Access defines a special object, DoCmd, that you use to carry out macro actions in 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. For a list of those actions and their Visual Basic equivalents, click .