====================================================================== Microsoft(R) Product Support Services Application Note (Text File) WX0636: ACCESS BASIC AND MACROS QUESTIONS & ANSWERS ====================================================================== Revision Date: 10/92 No Disk Included The following information applies to Microsoft Access(TM) version 1.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 1992 Microsoft Corporation. All Rights Reserved. | | Microsoft and MS-DOS are registered trademarks and Microsoft | | Access and Windows are trademarks of Microsoft Corporation. | -------------------------------------------------------------------- 1. Q. How can I run macros from Microsoft Access Basic? A. The following are three suggested ways to run macros from Access Basic: a. Create the macro using the macro editor and then call it from your Access Basic procedure. For example, if you create a macro called Macro1, you can call the macro from a procedure with the following command: DoCmd RunMacro "" b. Call the macro from the Immediate window using the same syntax as you would in Access Basic. Again, the syntax is as follows: DoCmd RunMacro "" c. Use DoCmd to run a macro action, rather than creating a macro specifically for that action. The basic format of DoCmd is as follows: DoCmd For more information on DoCmd, RunMacro, and macro actions, please refer to the "User's Guide and An Introduction to Programming"; or, search Help on the keywords "DoCmd" and "Expressions in Macros and Actions." 2. Q. When should I use the Variant data type? A. Use the Variant data type if you are unsure what type of data you are working with. When you use the Variant data type, Microsoft Access evaluates the data and then handles it appropriately. Using variants avoids the step of assigning data types to variables and manually converting data types in your programs. Further, when you store table data in variables, using variants eliminates complications with NULL data values. 3. Q. How do I comment out a macro action? A. With the macro in Design view, choose Conditions from the View menu. This adds the Condition column to the macro design. Type "false" (without the quotation marks) on the condition line for the macro action you want to comment out.