Adding a Macro to a Command Button in Access

by rhyttinen on December 7, 2010

If you're new here, you may want to subscribe to my RSS feed. Thanks for visiting!

Today we continue our discussion of Macros in Access. In addition to being run from the Macro Designer, macros can be assigned to controls such as Command Buttons. Command buttons are controls that you add to your form which provide you with a way of performing action(s) by simply clicking the control. To assign a macro to a Command Button, add it to the Command Button’s On Click Property. Thus, when a user clicks the button, the macro is executed.

Properties such as the On Click, On Got Focus, and On Double Click are called Events. An event is a specific action that occurs on or with a certain object. Access can respond to a variety of events such as mouse clicks, the opening or closing of forms, or changing the focus of a control. Events are usually the result of an action by a user.

Adding a Macro to a command button in Access

To Assign a Macro to a Command Button

  1. Create the macro that you want to execute.
  2. Open the form in Design View on which you wish to add a Command Button.
  3. If the Use Control Wizards button is activated, click it to deactivate it.
  4. Click the Command Button control on the Controls group on the Design Ribbon.
  5. Draw the Command Button on your form until it is the desired size.
  6. Select the Command Button and then click the Property Sheet button.
  7. Click in the On Click property box.
  8. Click the arrow and then select the macro you want to execute when the Command button is clicked.

Similar Posts:

Share and Enjoy:
  • del.icio.us
  • Digg
  • TwitThis
  • Reddit
  • Technorati
  • Facebook
  • StumbleUpon
  • Google Bookmarks
  • Propeller
  • email

Comments on this entry are closed.

Previous post:

Next post: