WX1236: Macro and Module Questions and Answers (7.0)

Last reviewed: October 21, 1997
Article ID: Q137348
The information in this article applies to:
  • Microsoft Access version 7.0

Moderate: Requires basic macro, coding, and interoperability skills.

The "Macro and Module Questions and Answers" (WX1236) Application Note contains questions and answers about macros and modules in Microsoft Access for Windows 95 version 7.0.

You can obtain this Application Note from the following sources:

  • Microsoft FastTips Technical Library
  • Microsoft Product Support Services

For complete information, see the "To Obtain This Application Note" section at the end of this article.

THE TEXT OF WX1236

  Microsoft(R) Product Support Services Application Note (Text File)
            WX1236: MACRO AND MODULE QUESTIONS AND ANSWERS
                                                   Revision Date: 9/95
                                                      No Disk Included

The following information applies to Microsoft Access, version 7.0.

 INFORMATION PROVIDED IN THIS DOCUMENT AND ANY SOFTWARE THAT MAY
 ACCOMPANY THIS DOCUMENT (collectively referred to as an Application
 Note) IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER
 EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED
 WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR
 PURPOSE. The user assumes the entire risk as to the accuracy and
 the use of this Application Note. This Application Note may be
 copied and distributed subject to the following conditions:  1) All
 text must be copied without modification and all pages must be
 included;  2) If software is included, all files on the disk(s)
 must be copied without modification (the MS-DOS(R)  utility
 diskcopy is appropriate for this purpose);  3) All components of
 this Application Note must be distributed together;  and  4) This
 Application Note may not be distributed for profit.

 Copyright (C) 1995 Microsoft Corporation.  All Rights Reserved.
 Microsoft, MS-DOS, Visual Basic, and Windows are registered
 trademarks and Windows NT is a trademark of Microsoft Corporation.
1. Q. What new macro actions are available in Microsoft Access for
      Windows 95?

   A. There are two new macro actions: Save and SetMenuItem. The Save
      macro action saves a specified Microsoft Access object (or the
      active object if none is specified). With the SetMenuItem macro
      action, you can make items on your custom menus unavailable
      (dimmed) or available (checked).

      You may notice that there is another new macro action called
      PrintOut, but this macro action is just the Print macro action
      from earlier versions of Microsoft Access with a new name.

      For more information about new macro actions, search on the
      phrase "What's new with macros" then view "Tell Me About:
      What's new with macros, modules, and developing applications?"
      using the Answer Wizard from the Microsoft Access Help menu.

2. Q. How do I turn off messages such as the one that tells me my
      query is about to update records?

   A. Use the SetWarnings action to set the Warnings On argument to
      No. When you use this action in a macro, you do not have to
      turn it back on. It is automatically turned back on when the
      macro finishes. However, if you use this action in a Visual
      Basic(R) for Applications procedure, SetWarnings stays off
      until you explicitly turn it back on.

3. Q. How can I convert my macros to Visual Basic for Applications
      code?

   A. You can now easily convert your macros to Visual Basic for
      Applications code by following these steps:

      1. In the Database window, click the Macros tab, and select
         your macro.

      2. On the File menu, click Save As/Export.

      3. In the Save As dialog box, click Save As Visual Basic
         Module, and click OK.

      If you chose a Typical or a Compact installation when you ran
      Setup, you do not have the Developer Tools installed, and you
      will receive an error message after step 3 above. To install
      the Developer Tools in Windows 95, follow these steps:

      1. Click the Microsoft Windows 95 Start button, point to
         Settings, and then click Control Panel on the menu that
         appears.

      2. Double-click the Add/Remove Programs icon, and then follow
         the instructions on the Install/Uninstall tab.

      To install the Developer Tools in Microsoft Windows NT(TM) 3.51,
      double-click the Microsoft Access Setup icon in your Microsoft
      Office group (or the group that contains your Microsoft Access
      icons).

      For more information about converting macros, search on the
      phrase "How do I convert a macro to code" then view "How Do I:
      Convert macros to Visual Basic for Applications" using the
      Answer Wizard from the Microsoft Access Help menu.

4. Q. Why can't I run macro actions from my module using the DoCmd
      statement anymore?

   A. The DoCmd statement has been replaced by the DoCmd object.
      Using the DoCmd object to run a macro action, you specify the
      DoCmd object followed by a method of the object. Microsoft
      Access for Windows 95 provides methods by the same name as
      macro actions, so typically the syntax is the same as in
      earlier versions of Microsoft Access, except that you use a
      period between the DoCmd object and the method name. For
      example, the following line

          DoCmd OpenForm "MyForm"

      changes to the following line in Microsoft Access for Windows
      95:

           DoCmd.OpenForm "MyForm"

5. Q. What happened to the Immediate window?

   A. The Immediate window is now part of the Debug window. The Debug
      window consists of two panes: an Immediate pane that functions
      much like the Immediate window of earlier versions of Microsoft
      Access, and a Watch pane. The Watch pane makes debugging Visual
      Basic code easier because you can watch the values of variables
      and expressions as your code runs. To invoke the Debug window,
      press CTRL+G anywhere in Microsoft Access.

      For more information about the Debug window, search for "Debug
      window" then "Using the Debug Window" using the Microsoft
      Access Help Index.

6. Q. I am using the On Error statement to trap errors in my Visual
      Basic for Applications code, and Microsoft Access still
      displays error dialog boxes. Why?

   A. You may have Break On All Errors set in the Options dialog box.
      This option forces Microsoft Access to display an error dialog
      box for every error that is encountered, including trapped
      errors. To turn this option off, follow these steps:

      1. On the Tools menu, click Options.

      2. Click the Modules tab, and then click to clear Break On All
         Errors.

TO OBTAIN THIS APPLICATION NOTE

  • You can have this Application Note mailed or faxed to you from the automated Microsoft FastTips Technical Library, which you can call 24 hours a day, 7 days a week at (800) 936-4100. NOTE: The FastTips Technical Library is available only to customers within the U.S. and Canada.
  • If you are unable to access the source(s) listed above, you can have this Application Note mailed or faxed to you by calling Microsoft Product Support Services Monday through Friday, 6:00 A.M. to 6:00 P.M. Pacific time at (425) 635-7050. If you are outside the United States, contact the Microsoft subsidiary for your area. To locate your subsidiary, please see the Microsoft World Wide Offices Web Site at:

          http://www.microsoft.com/worldwide/default.htm
    
Keywords          : Fstqa Softlib kbappnote kbfile kbfasttip
Version           : 7.0
Platform          : WINDOWS
Hardware          : x86
Issue type        : kbinfo


================================================================================


THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY.

Last reviewed: October 21, 1997
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.