Quickie! Is Microsoft Access VBA an Object Orientated Programming

I have never properly  understood what OOP is.

I can and do program VBA in Access.

Is this OOP??
Patrick O'DeaAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Kyle AbrahamsSenior .Net DeveloperCommented:
Not really.

From:
https://msdn.microsoft.com/en-us/library/aa289512(v=vs.71).aspx



For a programming language to be a true OOP language, the language must meet the following criteria:
Abstraction—Abstraction manages the complexities of a business problem by allowing you to identify a set of objects involved with that business problem.
Encapsulation—Encapsulation hides the internal implementation of an abstraction within the particular object.
Polymorphism—Polymorphism provides for multiple implementations of the same method. For example, different objects can have a Save method, each of which perform different processing.
Inheritance—The excitement of Visual Basic .NET lies in inheritance. Visual Basic 5 introduced the concept of interface inheritance, which allows you to reuse the interface of a class, but not its implementation. Visual Basic .NET provides for true implementation inheritance whereby you can reuse the implementation of a class.

You can't inherit / polymorph in VBA.
Jim Dettman (Microsoft MVP/ EE MVE)President / OwnerCommented:
No VBA is not object orientated programming. It's object based however. Subtle difference but it's a major one.

Jim
Michael FowlerSolutions ConsultantCommented:
No. VBA is not a OOP

While VBA does have objects and can perform object orientated programming but in a true OOP everything is an object and VBA does not meet this definition.

If you are looking to learn some Object Orientated Programming the logical step from VBA is to VB.Net

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
10 Holiday Gifts Perfect for Your Favorite Geeks

Still have some holiday shopping to do for the geeks in your life? While toys, clothing, games, and gift cards are still viable options for your friends and family, there’s more reason than ever to consider gadgets and software.

Patrick O'DeaAuthor Commented:
Thank folks!

I guess I don't know OOP - better change my CV!
DatabaseMX (Joe Anderson - Microsoft Access MVP)Database Architect / Systems AnalystCommented:
Like Jim said ... it's not a true OOP based on a strict definition.
However ... it's close enough for me :-)

mx
Jim Dettman (Microsoft MVP/ EE MVE)President / OwnerCommented:
Specifically at it's simplest, VBA lacks full inheritance.  You can't build a class on top of a class and extend it.

That's what an OOP language allows.  A simple example; a text control.    sub-types might be text, numeric, and date/time.  

In an oop language, I would have a base class of "text box" and then build three new classes off that.  Within my program, I would create instances using the sub-types.   If I made a change in the base class later (say to select the contents on gotfocus), that would be reflected in all the sub classes (You inherit all properties, events, and methods of your base class). This gives you a class hierarchy (think of a family tree).

Nothing like that exits in VBA.   I can make a copy of an object and modify that, but it's unrelated to the original.

There's a little more to it then that, but that's it in a nutshell.

Jim.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Access

From novice to tech pro — start learning today.