ACC97: RunCommand Constants Truncated After 25 Characters

Last reviewed: May 12, 1997
Article ID: Q168311
The information in this article applies to:
  • Microsoft Access 97

SYMPTOMS

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

When you convert any of the following RunCommand macro actions

   RunCommand CompileAndSaveAllModules
   RunCommand ConvertMacrosToVisualBasic
   RunCommand CreateShortcutMenuFromMacro
   RunCommand HorizontalSpacingMakeEqual
   RunCommand MicrosoftAccessHelpTopics
   RunCommand ObjBrwFindWholeWordOnly
   RunCommand ObjBrwShowHiddenMembers
   RunCommand QueryTypeSQLDataDefinition
   RunCommand QueryTypeSQLPassThrough
   RunCommand UserLevelSecurityWizard
   RunCommand VerticalSpacingMakeEqual

using the "Convert Macro to Visual Basic" command, the syntax is truncated during the conversion, and you receive the following error message when you compile the converted macro module:

   Compile error:

   Variable not defined

CAUSE

There is a 25 character limitation for the RunCommand constants when using the "Convert Macro to Visual Basic" command. This includes the acCmd prefix that is attached to the constant during the conversion.

RESOLUTION

To prevent your code from failing with a compile error, modify the syntax for the truncated constants before you compile and run the module.

MORE INFORMATION

Steps to Reproduce Behavior

  1. Create a new database in Microsoft Access 97.

  2. Create a new macro, and add the following RunCommand actions to the macro:

          Macro Name           Macro Action
          ---------------------------------
          Macro1               RunCommand
                               RunCommand
                               RunCommand
    
          Macro1 Actions
          --------------------------------------
          RunCommand
             Command: CompileAndSaveAllModules
          RunCommand
             Command: ConvertMacrosToVisualBasic
          RunCommand
             Command: UserLevelSecurityWizard
    
    

  3. Save the macro as Macro1.

  4. Select Macro1 in the Database window. On the Tools menu, point to Macro, and then click "Convert Macro to Visual Basic."

  5. After the conversion process is finished, open the converted macro module. Note the truncated constants.

  6. On the Debug menu, click Compile Loaded Modules. Note that you receive the error message mentioned in the "Symptoms" section.

REFERENCES

For more information about converting macros, search the Help Index for "macros, converting," and then "convert macros to Visual Basic," or ask the Microsoft Access 97 Office Assistant.


Keywords : CnvProb kbcode kberrmsg McrActn
Version : 97
Platform : WINDOWS
Hardware : x86
Issue type : kbprb
Resolution Type : Info_Provided


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: May 12, 1997
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.