VBA User Type & Classes


My question is this. I have a class A and class B. Class B is intialised in Class A when Class A is intialised. Class B contains a custom user type (Customer) I created, which is declared in a module. I then have declared a private variable of type Customer in Class B. It will not compile if the variable is declared as public. The problem I have is using the get & let properties to be able to read and write to the variable.

When the code is running and in Class A and I try to set the value of the CustomerID of the variable declared in Class B it runs but does not store a value, it actuals goes to the Property Get function? What am I doing wrong?  

Public Type Customer
  CustomerID as double
  CustomerName as string
  CustomerEmail as string
End Type

Any help would be brilliant!



Who is Participating?
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.

Wayne MichaelSenior Software DeveloperCommented:
Not sure if it applies to VBA,  but you can problem declare them as objects and pass it that way.


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
Scott McDaniel (Microsoft Access MVP - EE MVE )Infotrakker SoftwareCommented:
Can you show how you're defining ClassA and ClassB, and how you are going about setting the Customer.CustomerID of ClassB?

It would make sense that the Property statements would be higher on the food chain than something declared in a module, but I'm not sure I follow you fully.

Can you also show the relevant code for ClassA and ClassB?
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
Visual Basic Classic

From novice to tech pro — start learning today.

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.