Using "implements"

L

Laurel

I recently heard a talk about using inheritance in Access. Following my
notes, I created a form called frmAncestor, which had a msgBox statement in
its load event, and displayed a few columns from a table. Then I created a
form called frmDescendant, which had a msgBox statement in its load event as
well. Then I put this in its Open event Implements form_frmAncestor

But when I tried to compile with that Implements statement in place, I get
this error message "Function or interface marked as restricted, or the
function uses an Automation type not supported in Visual Basic."

What am I doing wrong?

TIA
LAS
 
W

Wolfgang Kais

Hallo Laurel.

Laurel said:
I recently heard a talk about using inheritance in Access.

Sounds interesting. How to us inheritance in Access? As far as I
know, inheritance is available in VB.NET, but neither in VB6 nor
in VBA (which is the "little brother" of VB (without .NET).
Following my notes, I created a form called frmAncestor, which
had a msgBox statement in its load event, and displayed a few
columns from a table. Then I created a form called frmDescendant,
which had a msgBox statement in its load event as well.
Then I put this in its Open event Implements form_frmAncestor

But when I tried to compile with that Implements statement in
place, I get this error message "Function or interface marked
as restricted, or the function uses an Automation type not
supported in Visual Basic."

In VB, Implements is not a statement but more like a directive:
At the class level, "Implements IMyInterface" tells the compiler
that your class has at least the same methods and properties as
the "interface" IMyInterface.
At the function level, you can use something like this:
Function MyFunc(i as Integer) as String Implements IMyInterface.Func
....
End FUnction
This is used to implement an element using a different name than
in the interface definition. This enables the use MyFunc through
an variable of type IMyInterface (for examlpe o) using this:
o.Func
The usage of Interfaces and their implementation provides only
interface-inheritance, which is no inheritance, because you have
to define every element of the interface manually. The inheritance
of code-implementation is available in VB.Net.
As much as I know, VBA does not even support "Implements" at all.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top