Solved

Access 2000 -    DoCmd.RunCommand acCmdSaveRecord

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

Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

Question has a verified solution.

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

I originally created this report in Crystal Reports 2008 where there is an option to underlay sections. I initially came across the problem in Access Reports where I was unable to run my border lines down through the entire page as I was using the P…
As tax season makes its return, so does the increase in cyber crime and tax refund phishing that comes with it
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…
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…

776 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