Microsoft KB Archive/137348

= ACC95: Macro and Module Questions and Answers =

Article ID: 137348

Article Last Modified on 11/17/2000

-

APPLIES TO


 * Microsoft Access 95 Standard Edition

-



This article was previously published under Q137348



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



SUMMARY
This article contains questions and answers about macros and modules in Microsoft Access 95 (version 7.0).



MORE INFORMATION
 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. 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. 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:

 In the Database window, click the Macros tab, and select your macro. On the File menu, click Save As/Export. In the Save As dialog box, click Save As Visual Basic Module, and click OK.</li></ol>

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:

<ol> Click the Microsoft Windows 95 Start button, point to Settings, and then click Control Panel on the menu that appears.</li> Double-click the Add/Remove Programs icon, and then follow the instructions on the Install/Uninstall tab.</li></ol>

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.</li>  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

<pre class="fixed_text">         DoCmd OpenForm "MyForm"

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

<pre class="fixed_text">          DoCmd.OpenForm "MyForm" </li> 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.</li> 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:

<ol> On the Tools menu, click Options.</li> Click the Modules tab, and then click to clear Break On All Errors.</li></ol> </li></ol>

Keywords: kbinfo KB137348

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.