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
Caltor
LVL 3
CaltorAsked:
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
0
 
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:

http://msdn2.microsoft.com/en-us/library/bb203849.aspx  'Transisitioning to A2007

http://support.microsoft.com/ph/11265    ' Various A2007 Issues  

http://blogs.msdn.com/access/archive/2006/06/05/618366.aspx    'A2007 Limitations list (most apply to A2003)

http://allenbrowne.com/Access2007.html   ' A bunch of good stuff

http://allenbrowne.com/Access2007.html#Bugs   'A2007 bug list

http://msdn2.microsoft.com/en-us/library/aa722523.aspx    'Ribbon

http://www.addintools.com/     '**** Bring back Office/Access 2003 menus.

http://support.microsoft.com/kb/934833   ' Issue Exporting a Report to Excel

A2007 Runtime (free):
http://www.microsoft.com/downloads/details.aspx?FamilyId=D9AE78D9-9DC6-4B38-9FA6-2C745A175AED&displaylang=eng

http://support.microsoft.com/kb/918583  'Workgroup Administrator utility in Access 2007

http://alexdyb.blogspot.com/2007/01/database-window-in-access-2007.html  'restore the old database window in 2k7.

http://msdn2.microsoft.com/en-us/library/bb421308.aspx   'Security considerations

http://office.microsoft.com/en-us/access/HA102269961033.aspx   Shift key until all security messages have passed.

Dual Install - stop the Configuration message:

http://uksbsguy.com/blogs/doverton/archive/2007/07/21/how-to-get-rid-of-the-installer-configuration-dialog-when-running-office-2007-and-office-2003-on-the-same-system-for-vista-and-other-versions-of-windows.aspx

mx
0
 
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.
0
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 ....

mx

0
 
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.
0
 
Greg85374Commented:
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.
0
 
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.
0
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.