Application vs DoCmd

AggieLJ

Registered User.
Local time
Today, 15:30
Joined
Jan 9, 2009
Messages
30
I have been reading some threads that Application is the new DoCmd... any opinions on the two? Any major limitations of one vs the other? I have my entire database written with DoCmds but if the majority agree that Application is more efficient, then I will update accordingly.

Thanks for your input!
 
If you are talking about most DoCmd code, it is just that the Application is the default above that and it isn't required to use it. There is a different quit command on Application.Quit or Docmd.Quit and I still haven't figured out what the real difference is there either.

So, I am also interested if anyone has some evidence as to why one would need to use Application in there.
 
I don't know either. In fact, I remain confused on a lot of the default objects/commands in Access. In my opinion there's a lack of consistency on how they are used, what they are used for, etc. However, I've just learned how to use the ones I need and use the most and I don't worry about the rest.
 
My guess is that when Access was first conceived it was intended to rely on macros for its functionality. A lot of DoCmd functions are (or were, anyway) described in the help files as executing the macro action of the same name. I suspect that DoCmd was invented to enable VBA, which probably came later, to execute Access macros, and then evolved from there.
But DoCmd and Application are not the same thing so to say one is the new version of the other is just not correct. DoCmd coopts funtionality from tons of other objects, like...
DoCmd.Hourglass coopts Screen.Mousepointer.
DoCmd.RunSQL coopts DAO.Database.Execute.
DoCmd.DeleteObject must leverage various other objects, since TableDefs are DAO (so DAO.TableDefs.Delete), but Forms are Access.
DoCmd.OpenForm is exclusive, or you can use non-default instances but then only some functionality is available.
Things like Echo and Beep and Quit are exposed by Application and DoCmd, but so what, big deal.

But mostly I avoid DoCmd because it's ugly. Look at it: DoCmd. Ick. It makes code look ugly and I think code should look beautiful.
 
as for Quit there are (me too don't know the difference):
Docmd.Quit
Application.Quit
Access.Quit

as for Docmd, it's simply the same Application.Docmd
 

Users who are viewing this thread

Back
Top Bottom