Known RunCommand Problems

If you know of any other problems when using RunCommand then please E Mail me Cecil Butts so that I can add details to this page.

Cannot Save Position of Form Using acCmdSave in Code
Cannot Use acCmdSaveModuleAsText in Code
Command Button Wizard does not use RunCommand
DoMenuItem not converted
RunCommand Constants Truncated
Missing Menu Items in Runtime Environment
Runtime - Filter By Form
Runtime- RunCommand action cancelled
SourceSafe Commands not available for RunCommand method

Cannot Save Position of Form Using acCmdSave in Code

Problem

In ver2 I had the following lines for saving the form position: (in Form_Unload)

DoCmd.DoMenuItem A_FORMBAR, A_FILE, A_SAVEFORM, , A_MENU_VER20

This doesn't seem to work properly, so I changed it to:

  1. DoCmd.DoMenuItem acFormBar, acFile, acSaveForm, , acMenuVer70
  2. DoCmd.DoMenuItem acFormBar, acFile, acSave, , acMenuVer70

Neither of these last commands seems do do what I could do in ver2. When I hit the save icon in the toolbar I get the desired result Can someone direct me to what DoMenuItem command I should use, so the users have their forms automaticly saved to the position it had when they closed the form.

Solution

Access 97 seems to have changed when the position of the form is saaved. Place the following code in the On_Resize event.

DoCmd.RunCommand acCmdSave

NOTE: This code will not work if AutoCentre is set to yes.

Return to Top of Page

DoMenuItem not converted

DoCmd DoMenuItem in version 2 code or DoCmd.DoMenuItem in version 7.0 code are not automatically converted to the Microsoft Access 97 RunCommand syntax, but the DoMenuItem syntax works correctly in Microsoft Access 97.

DoMenuItem macro actions are automatically converted to their equivalent RunCommand actions when you open a macro in the Macro window.

Return to Top of Page

RunCommand Constants Truncated After 25 Characters

There is a 25 character limitation for the RunCommand constants when using the "Convert Macro to Visual Basic" command. The affected RunCommands are:-

For more information and a solution see PSS ID Number: Q168311 ACC97: RunCommand Constants Truncated After 25 Characters on the Microsoft site.

Return to Top of Page

Filter By Form Error In Runtime

When you try to open a form in Filter-by-Form view programmatically in a Microsoft Access 97 run-time application, you may receive the following error message
Run-time error '2501':
The RunCommand action was canceled.

followed by:
Execution of this application has stopped due to a run-time error. The application can't continue and will be shut down.

For more information on this problem see PSS ID Number: Q172090 ODE97: Filter-By-Form Not Available in Run-Time Applications on the Microsoft site.

For a possible solution see PSS ID Number: Q166634 ACC97: Filter-by-Form Example for Run-Time Apps Available on MSL on the Microsoft site.

Return to Top of Page

Error Using RunCommand Method in Runtime

When you use the RunCommand method in a Microsoft Access 97 run-time application, you may receive the following error message:

The RunCommand action was canceled.

This occurs when using a method that prompts the user for an input or output file name. The following constants of the RunCommand method will cause this problem:

Return to Top of Page

Command Button Wizard does not use RunCommand

The Command Button Wizard still generates code using DoMenutItem rather than using the RunCommand method of the DoCmd object.

Return to Top of Page

SourceSafe Commands not available for RunCommand method

The RunCommand method does not expose the menu commands to control Visual SourceSafe Integration from either Visual Basic for Applications code or macros.

For more information on this problem see PSS ID Number: Q162931 on the Microsoft site.

Return to Top of Page

Missing Menu Items in Runtime Environment

When you build a custom menu bar in Microsoft Access 97 and include the built-in File menu, some commands do not appear on the menu in the run-time environment. For example, the Print command does not appear on the menu; as a result, you cannot modify the printer settings or properties. You can create a Microsoft Visual Basic for Applications function that displays the Print dialog box and attach that function to a custom Menu Bar.

For more information see Article 17379 on the Microsoft Knowledge Base.

Return to Top of Page