Solved

Access 2000 -    DoCmd.RunCommand acCmdSaveRecord

Posted on 2003-10-28
4
1,590 Views
Last Modified: 2012-08-13
   DoCmd.DoMenuItem acFormBar, acRecordsMenu, acSaveRecord, , acMenuVer70
is one way of saving a record.

    DoCmd.RunCommand acCmdSaveRecord
is another.

Is there any functional difference between them?
Is either “preferred”? [I like the second one- it seems less complicated, though the first one is generated by the form designer when adding a button with with "Save Record" functionality]

Is the first one prone to problems if there are menu changes?
0
Comment
Question by:starrynighter
  • 2
  • 2
4 Comments
 
LVL 2

Accepted Solution

by:
ericmca earned 50 total points
Comment Utility
your "acMenuVer70" shows you using old-version code.

Here'w what VBA Help says in Access 2000:
In Microsoft Access 97, the DoMenuItem method was replaced by the RunCommand method. The DoMenuItem method is included in this version of Microsoft Access only for compatibility with previous versions. When you run existing Visual Basic code containing a DoMenuItem method, Microsoft Access will display the appropriate menu or toolbar command for Microsoft Access 2000. However, unlike the DoMenuItem action in a macro, a DoMenuItem method in Visual Basic code isn't converted to a RunCommand method when you convert a database created in a previous version of Microsoft Access.

Some commands from previous versions of Microsoft Access aren't available in Microsoft Access 2000, and DoMenuItem methods that run these commands will cause an error when they're executed in Visual Basic. You must edit your Visual Basic code to replace or delete occurrences of such DoMenuItem methods.

SO -- use the one you like!  

(Not sure why your form designer is using old code -- are you sure it's Access 2000?)

-- Eric
0
 

Author Comment

by:starrynighter
Comment Utility
Thanks- it *is* 2000 (surely not a hangover from the 97 I loaded over?)
0
 
LVL 2

Expert Comment

by:ericmca
Comment Utility
I use Access 2000 too (SP 3).  The form designer will offer the DoMenuItem choice, but little help thereafter with the multiple parameters needed.  It also offers the RunCommand choice, and a list box from which a single selection of acCmdSaveRecord can be selected -- which is the only parameter needed.  Seems like the preferred way to go.  

-- Eric
0
 

Author Comment

by:starrynighter
Comment Utility
I'm not using SP3! - thanks for drawing my attention to it.
0

Featured Post

What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

Join & Write a Comment

This article is a continuation or rather an extension from Cascading Combos (http://www.experts-exchange.com/A_5949.html) and builds on examples developed in detail there. It should be understandable alone, but I recommend reading the previous artic…
In a multiple monitor setup, if you don't want to use AutoCenter to position your popup forms, you have a problem: where will they appear?  Sometimes you may have an additional problem: where the devil did they go?  If you last had a popup form open…
Learn how to number pages in an Access report over each group. Activate two pass printing by referencing the pages property: Add code to the Page Footers OnFormat event to capture the pages as there occur for each group. Use the pages property to …
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

743 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now