Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

This line of code works in Access97 but not 2000

Status
Not open for further replies.

JMM

Technical User
Feb 17, 2000
37
NZ
The following line works fine in Access97 but in Access2000 I get this error: Run-time error 2455. You entered an expression that has an invalid reference to the property Input Parameter.
The line is: DoCmd.DoMenuItem 7, 0, 2, , A_MENU_VER20' Save Report.
I guess it's something to do with the jet engine version but am not sure.
Help appreciated.
 
DomenuItem is depreciated, see below :

The RunCommand method runs a built-in menu or toolbar command.

Syntax

[object.]RunCommand command

The RunCommand method has the following arguments.

Argument Description
object Optional. The Application object or the DoCmd object.
command An intrinsic constant that specifies which built-in menu or toolbar command is to be run.
Remarks

Each menu and toolbar command in Microsoft Access has an associated constant that you can use with the RunCommand method to run that command from Visual Basic.
For a list of possible constants for the command argument, see RunCommand Method Constants. You can also view these constants in the Object Browser. Select Access in the Project/Library box, then select AcCommand in the Classes list. The constants appear in the Members Of list.

You can't use the RunCommand method to run a command on a custom menu or toolbar. You can only use it with built-in menus and toolbars.
The RunCommand method replaces the DoMenuItem method of the DoCmd object.
 
That looks like a line of code inserted by a wizard using Access 2.0. The object browser says it is a member of Access.OldConstants and is probably not supported in 97. In any event, when menus change from one version of Access to another, these hard coded menu commands are suspect to being incorrect. I too recommend converting the command.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top