What is the difference - code in Access versions?

Pharma Down

Registered User.
Local time
Today, 12:36
Joined
Dec 1, 2011
Messages
67
If I create a save button in Access 2010 the code is:

DoCmd.RunCommand acCmdSaveRecord

If I create a save button in Access 2003 the code is:

DoCmd.DoMenuItem acFormBar, acRecordsMenu, acSaveRecord, , acMenuVer70

I'm sure that there are other issues for buttons created using the wizard.

Why the difference and what does the difference mean for running my database in different systems?
 
The second was used for compatibility with 97 (I think). I use the first; it will work in either version.
 
The 2003 code is essentially like a recorded macro (like in Excel). If you saved record manually you would go to the menu bar, select Records and then click SaveRecord. When you use the wizard to create a command button it uses this method instead of the RunCommand acCmdSaveRecord.
Due to the introduction of the Ribbon menus from A2007, i believe the DoMenuItem will not work.
 
The DoMenuItem code was retained for backwards compatibility but as for the wizard actually using it, the Access Team didn't put resources towards fixing something that worked, even though it was not really up-to-date. They have limited resources and sometimes certain things take a back seat even when they really should be fixed.
 
So, I can use DoCmd.RunCommand acCmdSaveRecord, assuming that noone is running Access 97.

I am trying to make the database work across Access 2003, 2007 and 2010. I have noticed that Close buttons don't always work! I think that they are more succesful if created in 2003!

Thanks

Andy
 
OK, I'll try make sure that I use: DoCmd.RunCommand acCmdSaveRecord.

Thank you.
 

Users who are viewing this thread

Back
Top Bottom