• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1687
  • Last Modified:

Access 2000 - DoCmd.RunCommand acCmdSaveRecord

   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
starrynighter
Asked:
starrynighter
  • 2
  • 2
1 Solution
 
ericmcaCommented:
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
 
starrynighterAuthor Commented:
Thanks- it *is* 2000 (surely not a hangover from the 97 I loaded over?)
0
 
ericmcaCommented:
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
 
starrynighterAuthor Commented:
I'm not using SP3! - thanks for drawing my attention to it.
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now