Access Developer 50
Class Modules, Encapsulation, Properties & Methods
Welcome
Welcome to Microsoft Access Developer Level 50, brought to you by Access Learning Zone. I'm your instructor, Richard Rost.
This course introduces class modules in Microsoft Access, starting with user-defined types and moving into encapsulation, property management, and input validation. You will learn to create calculated and read-only properties to centralize business logic.
We will also add methods and behavior to classes, enforce business rules, and work with real-world customer data from tables, bringing everything together into a practical application.
Resources
Topics Covered
In Lesson 1, we will review how to use user-defined types (UDTs) in VBA, review their structure and limitations, and demonstrate how to create custom functions that work with UDTs, such as toggling properties and handling variable scope within forms. You will also learn why UDTs may fall short compared to class modules, setting the stage for building your first class module in the next lesson.

In Lesson 2, we will learn how to create your first class module, define public variables, instantiate the class, use the Set and New keywords, compare class modules to user-defined types, add methods directly to the class, and explain the importance of encapsulation, setting you up for more advanced concepts in the next lesson.

In Lesson 3, we will learn how to use encapsulation in class modules to protect and manage your data, set up private variables, implement property Get and Let procedures for controlled data access and validation, and apply a clear naming convention to avoid confusion in your code.

In Lesson 4, we will learn how to add calculated properties to your class modules, including creating read-only properties that return values like years active and full name based on other data in the class. We will also cover making a dynamic customer status property and demonstrate how calculated properties can simplify your code and keep everything organized inside your class.

In Lesson 5, we will learn how to add methods and behaviors to your class modules, including creating a deactivate method, enforcing business rules for actions like deactivation, using private helper functions, and keeping your form logic clean by centralizing code and formatting within the class itself.

In Lesson 6, we will learn how to build a practical example using classes by looping through all the customers in a table, assigning each one into a class, and displaying their name and status with class functions. You will learn how to use recordsets alongside class logic, handle property read/write issues, and expose specific fields with property let procedures for greater control over your data.

Enroll Today
Enroll now so that you watch these lessons, learn with us, post questions, and more!

Questions?
Please feel free to post your questions or comments below. If you are not sure as to whether or not this product will meet your needs, I'd rather help you before you buy it. Remember, all sales are final. Thank you.
Keywords
microsoft access, access 2016, access 2019, access 2021, access 365, ms access, #msaccess, #microsoftaccess, #help, #howto, #tutorial, #instruction, #learn, #lesson, #training, #database, class modules, user defined types, encapsulation, property get, property let, calculated properties, read-only properties, methods, behavior, customer records, object oriented access, access vba classes, form logic, business rules
Intro In this lesson, you will learn how to start using class modules in Microsoft Access VBA. We will review user-defined types, create your first class module, cover concepts like encapsulation, and set up calculated and read-only properties. You will also learn how to add methods and custom behaviors to your classes, and put everything together with a real-world example using customer data from your database.Transcript Welcome to Microsoft Access Developer Level 50, brought to you by accesslearningzone.com. I am your instructor, Richard Rost.
Today, we are going to begin our journey into class modules. We have done lots and lots of VBA programming with regular modules. I have always said, "This is the guy here, class modules, we are not going to be using." Well, today, we are going to start using that to build classes.
We are going to review user-defined types, which you have covered before in Developer 40. We are going to build a class module. We are going to learn about encapsulation. We are going to create calculated and read-only properties. We are going to add methods and behaviors to a class. Then, we are going to finish it all up with a real-world example using data from our customer table.
This class follows Access Developer 49. While I strongly recommend you take all of my classes in order, it is not necessary, but you should have a good, solid understanding of Access. The Beginner series is a must. The Expert series, especially the stuff on relationships, and Developer 16 will be important because we are going to use a record set today. So I do recommend you take them all. I strongly recommend you do not skip levels. Go see this page for more information on why.
It is currently 2025, so I am using an Access 365 subscription, which is roughly equivalent to Access 2024. The material covered in today's class should work all the way back to, I am guessing, Access 2007 or so.
If you have any questions regarding the material covered in today's class, just scroll down to the bottom of the page that you are on and post your questions there. Also, take a minute to read through any other questions that have been posted, as your question may have already been answered. If you want to get notified anytime someone posts a question or other information about this course, click on that red subscribe button.
If you have any other questions about Access in general, post them in the Access Forum. I have a great group of moderators and we all love helping people out with their questions.
Let us take a closer look at exactly what is covered in today's class.
In lesson one, before we get into class modules, we are going to review user-defined types, which we did cover initially in Developer 40. We are going to go into a little more detail and talk exactly about why user-defined types are limited as compared to what class modules can do.
In lesson two, we are going to create our first class module. We are going to create a new class module, give it a name, add public variables to it, instantiate the class and assign values. Then we will talk about how it compares to user-defined types.
In lesson three, we are going to learn about encapsulation. That is taking our variables and making them so that they are limited to just the class. You have to use the class to read and write the data. Not every form, not every report, can read the data directly from the class - only you can. That is called encapsulation. We will talk about that in this lesson.
In lesson four, we are continuing on with our class content. We are going to make calculated and read-only properties. We will make properties, which are basically like functions that you can have look at the data in the class and return certain information. So I could say, "Get me how many years this customer has been active." It knows customer since, it can figure that out - stuff like that. That is all covered in lesson four.
In lesson five, we are going to add methods and behavior to our class. It is no longer just about storing data and retrieving data. Now we can actually do things, for example, deactivating a customer. We can flip them from active to deactivated, but the logic is handled inside the class itself. We can add rules to it. You cannot deactivate a customer that is less than a year old, that kind of stuff. That is all covered in lesson five.
In lesson six, we are going to wrap it all up. With a real-world example, we are going to use a record set, loop through all the customers in our table, set each customer into a class using the class logic, and then display it with the class functions. So we get the full name and their customer status straight out of the class functions. It is going to be pretty cool. So check it out. That is all in lesson six.Quiz Q1. What is the main topic introduced in Microsoft Access Developer Level 50? A. Using macros to automate tasks B. Building and using class modules C. Creating complex queries D. Designing advanced forms
Q2. What programming concept will be revisited at the beginning of the class? A. Built-in Access functions B. User-defined types C. SQL Server integration D. Macro security settings
Q3. Why are user-defined types seen as limited compared to class modules? A. They cannot be used at all in Access B. They are slower than class modules C. Class modules allow encapsulation and behaviors, while user-defined types do not D. They only support numeric data
Q4. What is encapsulation as described in the video? A. Compressing your data file to save space B. Making variables accessible only through the class itself C. Linking tables from other databases D. Encrypting your VBA code
Q5. What is a calculated or read-only property in a class module? A. A variable that can be changed by any form B. A procedure that deletes records from the table C. A function-like feature that returns information based on class data D. A property that resets every time the database opens
Q6. What new feature is added to class modules in lesson five? A. Export to Excel method B. The ability to add methods and behaviors C. SQL query builder D. Form design templates
Q7. What example is used for demonstrating class module methods/behaviors? A. Importing data from CSV B. Deactivating a customer with logic handled inside the class C. Designing a navigation form D. Creating custom toolbars
Q8. In the final lesson, what real-world scenario is used? A. Data encryption for customer records B. Using a record set to loop through the customers table and using class functions for display C. Integrating Access with Outlook D. Creating dynamic charts
Q9. Which prior series does Richard recommend as a prerequisite for this class? A. Access Designer B. Access Beginner and Expert C. Access Presentation D. Access SQL Advanced
Q10. What should students do if they have questions about the class? A. Email technical support directly B. Post questions at the bottom of the class page or in the Access Forum C. Wait for the next class update D. Call the instructor personally
Answers: 1-B; 2-B; 3-C; 4-B; 5-C; 6-B; 7-B; 8-B; 9-B; 10-B
DISCLAIMER: Quiz questions are AI generated. If you find any that are wrong, don't make sense, or aren't related to the video topic at hand, then please post a comment and let me know. Thanks.Summary Today's TechHelp tutorial from Access Learning Zone takes us into the world of class modules in Microsoft Access VBA. Up to this point, we have worked almost exclusively with standard modules for our VBA programming, but now we are going to explore what class modules have to offer and learn how to build our own classes.
We will begin by revisiting user-defined types, which I covered previously in Developer 40. This is important because it helps illustrate why class modules are a more powerful solution for representing complex data and behavior in your applications. After this brief review, we will get hands-on by actually creating a class module. I will guide you through the process of naming the module, adding public variables, creating an instance of the class, assigning values, and then comparing this approach to what we did with user-defined types.
One key concept in object-oriented programming, and something we will focus on in the next lesson, is encapsulation. Encapsulation means keeping the internal variables of a class protected so that they can only be accessed or modified through specific class properties or methods. Not every form or report should have direct access to the data inside your class. Instead, the class itself controls how data is read or written.
Next, we will look at calculated and read-only properties. Properties in a class allow you to perform calculations or return specific pieces of data from within your class. For example, a property could calculate the number of years a customer has been active based on their account creation date. This is all handled within the class module and is an excellent way to centralize logic.
After this, we will see how to add methods and behaviors to your class. Storing and retrieving data is great, but classes can do much more. For instance, you might want a method that can deactivate a customer based on specific rules, such as not allowing deactivation of customers who have been active for less than a year. All of this business logic can now be built into the class itself.
Finally, we will tie everything together with a practical example. Using a record set, we will loop through all the customers in your table, create an object instance for each customer using your class logic, and display information such as full name and status directly from the class properties and methods. This example will highlight how you can manage and process data in a streamlined, object-oriented way.
This course builds on material from Access Developer 49 and benefits from a strong foundation in Access. I always advise taking my classes in order so you have the necessary background, especially if you are not yet comfortable with relationships and record sets, which we will be using today. While I am using the Access 365 subscription version, nearly everything we discuss here will still work back to around Access 2007.
If you have any questions about the material in this class, you are welcome to post them at the bottom of the course page. I also suggest reviewing questions already posted by other students, since your concern may have already been addressed. For general Access questions, head over to the Access Forum, where our community and moderators are eager to help.
In summary, here is the progression of what we cover in this class: - Lesson one is a detailed review of user-defined types and their limitations when compared to class modules. - Lesson two walks you through creating your first class module, naming it, adding variables, and understanding the major differences from user-defined types. - Lesson three introduces the concept of encapsulation and how to control access to your class data. - Lesson four demonstrates how to create calculated and read-only properties to return information and perform logic within your class. - Lesson five expands your class by adding methods and behaviors, allowing you to build rules and processes, such as deactivating customers with constraints. - Lesson six brings it all together with a real-world example using customer data, class objects, and class-based display functions to show the full power of this approach.
You can find a complete video tutorial with step-by-step instructions on everything discussed here on my website at the link below. Live long and prosper, my friends.Topic List Reviewing user-defined types Limitations of user-defined types Creating a class module Naming and adding variables to a class module Instantiating and assigning values to a class Comparing class modules to user-defined types Understanding encapsulation in classes Restricting variable access with encapsulation Creating calculated properties in a class Creating read-only properties in a class Adding methods and behaviors to a class Implementing business logic inside a class Adding deactivation rules for a customer Using recordsets with class modules Loading customer data into classes Displaying customer information with class functions
|