Microsoft Access
  Home arrow Microsoft Access arrow Page 4 - Jump Start VBA Skills with MS Access Macro...
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

Jump Start VBA Skills with MS Access Macros
By: Jayaram Krishnaswamy
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 4 stars4 stars4 stars4 stars4 stars / 29
    2005-11-08

    Table of Contents:
  • Jump Start VBA Skills with MS Access Macros
  • Creating and running a macro in MS Access: opening the macro designer
  • Creating the first macro
  • Converting this macro to VBA code
  • Creating the second macro

  • 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


    Jump Start VBA Skills with MS Access Macros - Converting this macro to VBA code


    (Page 4 of 5 )

    Right click on the macro and from the drop-down click on Save As. In the dialogue, using the drop-down, change Save Macro 'MyBeep': as Module.

    In the message that follows, keep the defaults and click Convert. This will add automatic error handling code block to the VBA Code as well as the comments that were inserted earlier in the designer.

    This gives you an audio alert followed by a new set of screens with a congratulatory massage feed back --"Conversion Finished!" -- as shown. (The congratulatory screen was turned off for this picture).

    Now you have a VBA program which does the same thing as the macro under the Project - Macro. The project window of the Microsoft Visual Basic editor has all of the Microsoft Access Class objects, modules, and class modules in the acwztool set node and the macro program that you just converted.

    Let's look at what you have created now and later -- much later -- look at the other aforementioned objects. Double click Converted Macro-MyBeep, this opens up the code window as shown. As you can see, the macro was converted to a function with the same name you gave earlier for the macro. The function calls the 'beep' procedure, which does the beeping through the hardware interface. You can also see the error handling code automatically added.

    The logos below the menu bar help you to switch between Access, VB editor and graphic user designer pages quite easily. You can also use the icons to run, stop or pause the macro. Please refer to earlier Access tutorials to get a good handle on the menu objects and navigational possibilities. The editor window also gives you access to all the 'debugging' tools for looking through your programs.

    Another utility of great value in learning VBA is the online help. Just remember the 'F1' key. It will open up the help file at the location highlighted prior to hitting the 'F1' key. Let's highlight 'beep' and hit 'F1'. This opens up the following page which describes what 'Beep' does.

    This was too easy. Let's create a slightly more elaborate macro and see a lot more of VBA in the second macro.

    More Microsoft Access Articles
    More By Jayaram Krishnaswamy


       · It's my pleasure to welcome you to read and comment on this article. VBA is a...
       · Is it possible to add a pop up window in Access.fro instance if one has a stock...
       · Does not mean I have a code ready. With DAP you should be able to do this and much...
       · Hello!Not sure where to look for the "steps for query and report creation",...
       · By the quoted text in your question, what I mean is, that I am assuming that I am...
     

    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 6 hosted by Hostway
    Stay green...Green IT