MenuItem Decoding

  • Thread starter Thread starter Jerry Stoner
  • Start date Start date
J

Jerry Stoner

Guest
I've been given the task of updating a db built by a forrmer employee of a company I consult. The following code which I'm sure was converted from a macro shows up over and over again. Where do I find out what this(especially the acRecordsMenu, 5 part. Allready been to help and did not find.

DoCmd.DoMenuItem acFormBar, acRecordsMenu, 5, , acMenuVer70

esperatly seekingf....
Thanks
 
That is simply a refresh command that a button wizard built.

ken
 
Follow the attached gif image:

DoCmd.DoMenuItem acFormBar, acRecordsMenu, 5, , acMenuVer70

acFormBar = On the standard form menu bar

acRecordsMenu = On the 'Records' menu item

5 = Do the 5th item down from the top, which is the 'Refresh' command.

Hope this helps,
ken
 

Attachments

  • refresh2.GIF
    refresh2.GIF
    33.3 KB · Views: 219
That looked like a picture of a newer version of Access. The problem is that acMenuVer70 means Access 95! No one but Mike75 has that version installed!

Do a google search. I once found a web page that listed all these old menu items and cross referenced them to the RunCommand constants. I don't have the link any more but I think the site was actually devoted to the RunCommand and included the other stuff as a cross reference.
 
Pat Hartman said:
That looked like a picture of a newer version of Access. The problem is that acMenuVer70 means Access 95! No one but Mike75 has that version installed!

Do a google search. I once found a web page that listed all these old menu items and cross referenced them to the RunCommand constants. I don't have the link any more but I think the site was actually devoted to the RunCommand and included the other stuff as a cross reference.

Pat,

I had that same site somewhere.

Here is a macro converted to module in Access 95 and a some DoMenuItem macro actions. I think it became RumCommand as a macro in A2000 and in a macro in converts OK when A95 is converted to A2000

Function Macro380()

If (Eval("[Forms]![MasterForm]![CopyDone] Is Not Null")) Then
DoCmd.RunMacro "Macro410", , ""
End If
If (Eval("[Forms]![MasterForm]![CopyDone] Is Not Null")) Then
Forms!MasterForm!CopyDone = Null
End If
DoCmd.Echo False, ""
DoCmd.OpenForm "SalesNotes", acNormal, "", "[NameNumber]=[Forms]![PrintandClose]![NameNumber]", acEdit, acNormal
DoCmd.OpenForm "SalesNotesOptions", acNormal, "", "", acEdit, acNormal
DoCmd.GoToControl "DateTime"
DoCmd.DoMenuItem 0, 5, 1, 1, acMenuVer70 ' Form, Records, Sort, Descending
DoCmd.GoToRecord , "", acFirst
Forms!SalesNotes!OneOffMerge = Forms!SalesNotesOptions!OneOffMerge
DoCmd.Close acForm, "SalesNotesOptions"
DoCmd.Close acForm, "SalesNotes"
DoCmd.DoMenuItem 0, 5, 4, 0, acMenuVer70 ' Form, Records, Save Record

End Function
 
Pat Hartman said:
That looked like a picture of a newer version of Access. The problem is that acMenuVer70 means Access 95! No one but Mike75 has that version installed!

Do a google search. I once found a web page that listed all these old menu items and cross referenced them to the RunCommand constants. I don't have the link any more but I think the site was actually devoted to the RunCommand and included the other stuff as a cross reference.

http://home.clara.net/tkwickenden/domenuitem.htm
 
Pat Hartman said:
That looked like a picture of a newer version of Access. The problem is that acMenuVer70 means Access 95! No one but Mike75 has that version installed!
'acMenuVer70' means Access 95' - No to sure about this one - Ver70 may refer to '95 but I think the menu stuff rolled foward. The wizard in my version of 2000 used it... Wonder what xp plugs in?

Anyway, my main point was to illustrate what it was doing and how to reverse engineer it. BTW- You can get the values for these constants through the object browser...

Ken
 
a strange thing which i notice is that such command are considered as defunct on this forum (i agree because the new ways are more user friendly and easy to remember). However, the wizards in Access still makes use of them :confused:
 
Thanks alot guys. It appears it is a refresh. Really wish access didn't convert code this way. What a pain.
 
'acMenuVer70' means Access 95' - No to sure about this one - Ver70 may refer to '95 but I think the menu stuff rolled foward. The wizard in my version of 2000 used it... Wonder what xp plugs in?
- The last argument is what identifies the version of Access whose menu is being referred to. I think you will find that Microsoft has tried to keep the menu items compatable with older versions but I wouldn't trust it. Too many items have been added to the menus over the years.

This is from help. Look up domenuitem from help in the VBA window to find more info.

Also, when you are counting down the lists for the Menu Bar, Menu Name, Command, and Subcommand action arguments in the Macro window to get the numbers to use for the arguments in the DoMenuItem method, you must use the Microsoft Access 95 lists if the Version argument is acMenuVer70, the Microsoft Access version 2.0 lists if the Version argument is acMenuVer20, and the Microsoft Access version 1.x lists if Version is acMenuVer1X (or blank).


Note There is no acMenuVer80 setting for this argument. You can't use the DoMenuItem method to display Microsoft Access 97 or Microsoft Access 2000 commands (although existing DoMenuItem methods in Visual Basic code will still work). Use the RunCommand method instead.


Thanks for the link Mike.
 
Last edited:

Users who are viewing this thread

Back
Top Bottom