Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here


Access VBA OOP Implements method not executing

Access VBA OOP Implements method not executing

Access VBA OOP Implements method not executing

I coded a simple example of a base class and child class. The base class has one filed and the Let and Get "dummy" properties to maintain it. The implementation of the Let and Get properties are coded in the child class.

The problem is that the child properties are not being executed. Instead, the parent properties are executed.

Here is more detail

I have a base class "clsSimple" that defines Private CustomerName as String.

In the base class I coded (abbreviated below):

Private Property Get CustomerName()
end Property
Private Property Let CustomerName()
end Property


The child class is an Access form with a button.

In the child class I coded (abbreviated):

'----- aForm--------------

Implements clsSimple

Private Property Get clsSimple_CustomerName()
End Property

Private Property Let clsSimple_CustomerName()
End Property

Private Sub aButton_Click()
 Dim objSim As clsSimple
 Set objSim = New clsSimple

 objSim.CustomerName = "George"

 Set objSim = Nothing

End Sub


My expectation was that when aButton_Click() is executed, the statement objSim.CustomerName = "George" would execute the Set property of the child class, it being the implementation of the parent property.

Instead, the Set property of the base class is being executed.

Where have I gone wrong?


RE: Access VBA OOP Implements method not executing

Basic idea of what's wrong is that you're not making a reference to the class that implements clsSimple at all. You're instantiating the clsSimple class and assigning it values directly.

Have a go with:


Set objSim = New aForm
Step through it and see the properties being set in the class implementing clsSimple.

Hope this helps, if you'd like any further information about what's happening with the implementation don't hesitate to ask.

Hope this helps

Zebracorn: 50% Zebra, 50% Unicorn = 100% Real.


RE: Access VBA OOP Implements method not executing

That is it exactly. I created an instance of the wrong class. DUH.
Thanks for the response!

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close