Does Access 2007 VBA support class inheritance?

Does VBA in Access 2007 support class inheritance? and if so how?
I know how to create a class in a class module but I don't know how to create another class based on the first one.

Eg I have a class called Invoice
I want 4 more classes based upon Invoice called InvoiceA, InvoiceB, InvoiceC, InvoiceD
In other languages I have used such as Visual Foxpro you can do this by specifying
Define Class InvoiceA as Invoice
but I can't see how to do this in Access 2007 VBA.
Is it even possible?

Many thanks
Who is Participating?
grayeConnect With a Mentor Commented:
The quick answer is "no"...

However, if you'd like to ditch VBA and move up to VB.Net (or C#, etc), then you'd get full inheritance
DatabaseMX (Joe Anderson - Microsoft Access MVP)Connect With a Mentor Database ArchitectCommented:
I don't believe there has been any change in this regard.

See these links I am accumulating for A2007 - a good reference in general:  'Transisitioning to A2007    ' Various A2007 Issues    'A2007 Limitations list (most apply to A2003)   ' A bunch of good stuff   'A2007 bug list    'Ribbon     '**** Bring back Office/Access 2003 menus.   ' Issue Exporting a Report to Excel

A2007 Runtime (free):  'Workgroup Administrator utility in Access 2007  'restore the old database window in 2k7.   'Security considerations   Shift key until all security messages have passed.

Dual Install - stop the Configuration message:

CaltorAuthor Commented:
Thank you guys

DatabaseMX, by 'there has been no change' I assumed that you meant no. But thank you to graye for clarifiying the answer and making an alternative suggestion. Unfortunately I am too far down the road on this project for a transition from Access to .NET so I will have to use some good old fashioned Select Case statements for now.
Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

DatabaseMX (Joe Anderson - Microsoft Access MVP)Database ArchitectCommented:
Well, one thing I've learned on the site ... never say No unless you are 201% sure.  Since I've only spent a little time with A2007, didn't want to make a blanket statement.  

btw ... don't forget ... Class modules and related functionality
 are very powerful in  VBA.

Thanks for the points ....


CaltorAuthor Commented:
Actually I reverted my class back to a function in the end as I couldn't see much of an advantage at all without inheritance. In fact I found that when an error was encoutered in the method/function the debugger pointed me to the calling procedure rather than the actual problematic line in the class method. Seems like the debugger hasn't caught up with class modules yet, Of course I would love to be proved wrong.
This is not completely True.  You can do what you asking.  In the class you want to inherit from you put Implements "someclassname" in the declaration section.  In the class you want to use the first class in (your child class) you use SomeClassName_MethodName.  YOu must qualify the parent class procedure with the class name followed by an underscore followed by the procedure name.  Its not true inheritence but it will do what you asked.....
I do not think this is documented but I hope it helps...
Oh, also you must repeat the above steps for every procedure in your parent class or you will get a compile error.
CaltorAuthor Commented:
Thanks for the extra info.
I will look into that next time this issue crops up.

PS. I think what I said about the debugger isn't true either. There seems to be an option int eh debugger - tools - options to set whether the debugger breaks in class methods or not.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.