acMenuVer70 commands help

  • Thread starter Teresa Thomas via AccessMonster.com
  • Start date
T

Teresa Thomas via AccessMonster.com

Hi,
I have some old code I've inherited which uses the following statement.

DoCmd.DoMenuItem acFormBar, acEditMenu, 8, , acMenuVer70

I see it used throughout examples on this site, and call me a bobo, and
while I have a general feel..I don't know "EXCACTLY' what it does. I've
looked through help where it explains how to use these, but I am using
Access 2000, where can figure out what the various acEditMenu menu options
(6,7, 9,10 etc)on menuver70 mean when they are used in this code?

Grateful thanks for your site and help!
Regards,
Teresa
 
G

Graham Mandeno

Hi Teresa

The DoMenuItem method has been obsolete since Access 95 and should be
avoided.

The line you quote below:
DoCmd.DoMenuItem acFormBar, acEditMenu, 8, , acMenuVer70)
means:
"perform the eighth item (counting from zero) in the Edit menu
on the Form View toolbar which you would see if you were running
Access 7.0 (Access 95)"

This happens to be "Select record".

You may be forgiven for being confused!

As far as I can recall, the following values can be used for the edit menu:
0 Undo
1 Cut
2 Copy
3 Paste
6 Delete
8 Select record
9 Select all records

Each of these has a better way to achieve the same result in Access 97
onward. For example,
Me.Undo, or Me.SomeControl.Undo
or, if there is no other way, use RunCommand:
DoCmd.RunCommand acCmdSelectRecord

Unfortunately, the product developers haven't yet caught up with the fact
that it's ten years since 1995, so the code generated by the form control
wizards uses DoMenuItem extensively.

For example, the wizard-generated code to delete the current record does
this:
DoCmd.DoMenuItem acFormBar, acEditMenu, 8, , acMenuVer70
DoCmd.DoMenuItem acFormBar, acEditMenu, 6, , acMenuVer70

(in other words, select the current record, then delete it)

It is much better to use:
DoCmd.RunCommand acCmdDeleteRecord

I advise you to go on a witch-hunt to find all instances of DoMenuItem in
your code and replace them with something a little more up-to-date.
 
T

Teresa Thomas via AccessMonster.com

Thank you so very much. Yes..I am replacing them whereever and whenever I
can. This information will be extremely helpful!

I can't tell you how much I value this site! Thanks so much.
Teresa
 
Joined
Apr 22, 2008
Messages
7
Reaction score
0
Is there a site that has all the Access95, 97, ...maybe even 2000, menu items or pictures of the menus somewhere. Especially with A2007 it's not even close, so no way to guess if you don't have copies available of the older versions. It would make converting old code much easier.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top