Solved

Access 2000 -    DoCmd.RunCommand acCmdSaveRecord

Posted on 2003-10-28
4
1,603 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

Comprehensive Backup Solutions for Microsoft

Acronis protects the complete Microsoft technology stack: Windows Server, Windows PC, laptop and Surface data; Microsoft business applications; Microsoft Hyper-V; Azure VMs; Microsoft Windows Server 2016; Microsoft Exchange 2016 and SQL Server 2016.

Question has a verified solution.

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

Most if not all databases provide tools to filter data; even simple mail-merge programs might offer basic filtering capabilities. This is so important that, although Access has many built-in features to help the user in this task, developers often n…
It took me quite some time to sort out all the different properties of combo and list boxes available from Visual Basic at run-time. Not that the documentation is lacking: the help pages are quite thorough and well written. The problem was rather wh…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

932 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

12 Experts available now in Live!

Get 1:1 Help Now