Microsoft Access
  Home arrow Microsoft Access arrow Page 2 - Getting to Know Microsoft Access, Part 9: ...
ASP Free Forums 
.NET  
ASP  
ASP Code  
ASP.NET  
ASP.NET Code  
BrainDump  
C#  
Code Examples  
Database  
Database Code  
IIS  
Microsoft Access  
MS SQL Server  
Visual Basic.NET  
Windows Scripting  
Windows Security  
XML  
ASP Web Hosting  
ASP.NET Web Hosting 
Mobile Linux 
App Generation ROI 
Windows Web Hosting
 
IBM® developerWorks 
Sun Developer Network 
Weekly Newsletter
 
Developer Updates  
Free Website Content 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us Get Paid 
Request Media Kit
Contact Us 
Site Map 
Privacy Policy 
Support 
 USERNAME
 
 PASSWORD
 
 
  >>> SIGN UP!  
  Lost Password? 
MICROSOFT ACCESS

Getting to Know Microsoft Access, Part 9: Macros
By: Sage Adams
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 3 stars3 stars3 stars3 stars3 stars / 18
    2005-03-22

    Table of Contents:
  • Getting to Know Microsoft Access, Part 9: Macros
  • Macros
  • Debugging
  • Getting Fancy with Macros

  • Rate this Article: Poor Best 
      ADD THIS ARTICLE TO:
      Del.ici.ous Digg
      Blink Simpy
      Google Spurl
      Y! MyWeb Furl
    Email Me Similar Content When Posted
    Add Developer Shed Article Feed To Your Site
    Email Article To Friend
    Print Version Of Article
    PDF Version Of Article
     
     
    ADVERTISEMENT


    Getting to Know Microsoft Access, Part 9: Macros - Macros


    (Page 2 of 4 )

    A macro is essentially a list of actions that you apply to objects to respond to events. Each action carries out one task. You create your actions in the order you want them to execute. In addition, you specify the arguments of the actions, giving the program additional information as needed.

    Finally, you can set conditions for each action in a macro to determine whether it runs or not. Run a macro by applying it to the event property of an object. Once the specified event occurs the macro will run by running the all the specified actions. Actions that have conditions applied to them may or may not run depending on whether or not they passed the conditional tests.

    Once you've created your macros you'll see them listed in the Macros tab in the Database window. This way you can attach any macro to any event property in your database.

    Creating Your First Macro

    As in any programming endeavor it is helpful to first design your macro before you build it. To do this, list the actions you want to occur, and in what order you want them to occur. Also describe the event you want the macro to apply to. Check the Access help feature to determine if the macro you are building is right for the event property you are planning to apply it to. Determine in advance which arguments each action will have and whether it will be conditional or not. What are the conditions? What are the arguments? You should sort out all these details before you start building your macro. Use pseudocode if you know it.

    To build your first macro, click "New" in the Macros tab of the Database window. Here's what the Create New Macro window looks like:

     

    Select your first action from the Actions column in the Macro window. Remember to put in a comment so you remember what the action is for. When you select your first action the arguments pane opens up below. You can either type in the arguments you want, or select from what is available in the drop-down lists. Current arguments are displayed to the right of the argument pane.

    If the argument requires an object name you can either type in the name or drag it from the Database window. Finally, you can set the argument to an expression that evaluates to the desired argument value. For instance, you could type in =[LastName] to set the argument value to the LastName control. The Expression Builder (click the Build… link) helps you build your expressions; not all arguments accept expressions.

    More Microsoft Access Articles
    More By Sage Adams


       · Hi,overall content of article is good,but where r the examples? In detail...
     

    MICROSOFT ACCESS ARTICLES

    - Linking SQL Express 2005 Tables to MS Access...
    - Working with Access Projects in Access 2007
    - Exploring Access 2007
    - Working with Stored Procedures in an MS Acce...
    - Creating and Using Action Queries
    - Creating Data Access Pages with Charts using...
    - Advanced Ideas using VBA
    - VBA Details
    - Updating Records in MS Access
    - Using ADO`s Record Object with URLs
    - Exporting XML from MS Access 2003
    - Importing XML into MS Access 2003
    - On Using Pass-through Queries in MS Access
    - Distributed Queries in MS Access
    - Configuring a Linked Microsoft Access Server...





    © 2003-2008 by Developer Shed. All rights reserved. DS Cluster 4 hosted by Hostway
    Stay green...Green IT