Solved

Access 2000 -    DoCmd.RunCommand acCmdSaveRecord

Posted on 2003-10-28
4
1,625 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
ID: 9637668
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
ID: 9644876
Thanks- it *is* 2000 (surely not a hangover from the 97 I loaded over?)
0
 
LVL 2

Expert Comment

by:ericmca
ID: 9644945
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
ID: 9645052
I'm not using SP3! - thanks for drawing my attention to it.
0

Featured Post

The Eight Noble Truths of Backup and Recovery

How can IT departments tackle the challenges of a Big Data world? This white paper provides a roadmap to success and helps companies ensure that all their data is safe and secure, no matter if it resides on-premise with physical or virtual machines or in the cloud.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

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…
Phishing attempts can come in all forms, shapes and sizes. No matter how familiar you think you are with them, always remember to take extra precaution when opening an email with attachments or links.
Familiarize people with the process of utilizing SQL Server views from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Microsoft Access…
In Microsoft Access, learn the trick to repeating sub-report headings at the top of each page. The problem with sub-reports and headings: Add a dummy group to the sub report using the expression =1: Set the “Repeat Section” property of the dummy…

808 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