Microsoft Access - Converting Form Code To A Reusable Class Module

preview_player
Показать описание
An introduction into how we can convert existing Form module code into Class Modules to SubClass Microsoft Access form and command buttons to standardize their look, behavior and simplify overall development.

Using VBA Class Modules to SubClass Microsoft Access forms/reports is a great way to centralize design characteristics (colors, fonts, positioning, ...) and behaviors (Event Procedures) making it much easier to maintain application in the long haul.

Article(s) on this Subject:

My Links:
Рекомендации по теме
Комментарии
Автор

Thank you Daniel. Excellent follow-on and tie-in from your "Save Button" video. Great explanation and tutorial on Class module, With Events and implementation/usage. The formatting and framework ideas are not often discussed. Well done!

orange
Автор

Thank you for taking the time to explain this. What would help is if there was some kind of a relationship image to explain how all of the code relates to each form component and class. I have never seen anyone present it in a relationship type map before, but it would help to see where all the relationships are.

bumpersmith
Автор

Daniel,
Gr-r-r-eat video! Appreciate your detailed explanations. Could this form subclass strategy work between external databases?

I have several databases that are clones of each other, each serving a particular project id.

I am planning to establish a library database referenced by each of the clone database. Goal is to make form class modules in the library databases. Any changes in the library database form class modules properties, methods and events will update all the clone databases.

This would be a great time saver because it would reduce the painful effort to laboriously make the same changes to forms in each cloned databases!

Your thoughts and recommendations would be appreciated.

Thank you always for your hard work and kind helpfulness and sharing these concepts and ideas with us!

wildmagic
Автор

It's a brilliant way of working. Thank you once again!

horatiurotar
Автор

Hello Daniel, I'm new to Access and enjoy browsing your site ans YT-videos. I tried this project straight away and it works great. Since I have no experience with class programming, I'm wondering whether it might be possible to add navigation buttons for forward, back, etc. to this class. Thank you for any information.

franzreber
Автор

I applied the solution, and it works perfectly! This is my first time using classes in VB, and I found the post very useful. Thank you once again! Could we also use the same classes to update a subform?

horatiurotar
Автор

One worthy mention, I tried copying the modules from your website copy, pasting and structuring them as described - for some reason I couldn't get the class modules to work. Since no one else drops a mention of this. I then copied each from the website into Notepad with the goal of removing any underlying formatting and/or curly quotes. After that it worked. In the midst of the buttons being unresponsive, I checked a couple of times making sure I had all of the code and I seemingly did. Sharing, just in case anyone else runs into this.

ashiem
Автор

Thanks for this tutorial! I've tried it and it works beautifully. Question; could I implement a button with an event module in the form, that calls the click event from one of the buttons that was subclassed though your method? Say I have added a "new record" button through subclassing, and a form specific "copy record" button that needs to perform stuff before and after pressing the "new record" button?

JorisTielkes
welcome to shbcf.ru