Reference for DoCmd...

santosm
3StarLounger
Posts: 253
Joined: 19 Apr 2010, 09:01
Location: Indiana, USA

Reference for DoCmd...

Post by santosm »

Hi All,
Does anybody know if a good reference for this:

Code: Select all

DoCmd.DoMenuItem acFormBar, acRecordsMenu, acSaveRecord, , acMenuVer70
I would like to know what this command does and what the options are. I found some stuff on the web but most of it was cryptic at best.

Thanks,
Mark
Thanks,
Mark

User avatar
HansV
Administrator
Posts: 78391
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: Reference for DoCmd...

Post by HansV »

DoMenuItem provides a way to invoke menu commands in VBA. It is a relic from early versions of Access.
Although it still works, it has been superseded by RunCommand. The equivalent of the line that you posted is

Code: Select all

RunCommand acCmdSaveRecord
See Converting DoMenuItem to RunCommand for a list of the RunCommand equivalents of some of the DoCmd.DoMenuItem instructions.
Best wishes,
Hans

santosm
3StarLounger
Posts: 253
Joined: 19 Apr 2010, 09:01
Location: Indiana, USA

Re: Reference for DoCmd...

Post by santosm »

Hi Hans,
I am trying to find what the command is for "Add New Record". My searches have resulted in nothing....

Thanks,
Mark
Thanks,
Mark

User avatar
HansV
Administrator
Posts: 78391
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: Reference for DoCmd...

Post by HansV »

You can use

Code: Select all

RunCommand acCmdRecordsGoToNew
This is the VBA equivalent of clicking the new record button on the ribbon or in the navigation buttons: it moves the form to a blank new record. The record won't actually be created until you enter a value in one of the bound controls, either manually or through code.
Best wishes,
Hans