SparklySpartan
New member
- Local time
- Today, 15:41
- Joined
- Feb 25, 2025
- Messages
- 22
Hi everyone,
I have more of a theoretical question today, I'm mostly looking for inspiration on how I might be able to take advantage of the OOP paradigm in the application I'm working on. I guess the general and very open ended question I have is this:
"Can I have some examples from fellow Access programmers of how you've utilized classes and OOP in your databases to write more effective and easy to maintain code? Is there even any such thing as coding using the OOP paradigm in Access?"
Here's What Lead Me to Ask This if It Seems Random...
This came into my mind as I was working on planning out some behavior for two different forms of mine. I realized that there's a field I want to be able to change on two different forms called "Due_Date". I also have a "Reminder_Date" concept in a different field, whenever the Due_Date field gets changed, I want to automatically change the Reminder_Date as well such that the days between them remain consistent. If I bump the due date up 5 days, the reminder date gets bumped up 5 days as well to maintain the distance between them. This is by no means hard to do, but to the best of my knowledge, I would have to write the same code in two places, or (better of course) have a subroutine that does this and gets called in two places.
The same subroutine getting called in multiple places isn't the end of the world, but what if in the future there's another form that changes the due date, and another? I would have to continuously remember to add calls to the subroutine or otherwise get inconsistent behavior throughout my application.
I sort of wish there was a way to define a protocol, every time I change the Due_Date field, independent of the form I changed it from, I want this behavior to occur.
I'm curious of there's some clever way to structure my codebase to allow for this kind of thing. Please, correct me if I'm wrong, because I am no OOP expert at all, but this is one of the many strengths of OOP that I think I understand, the ability to restrict access to changing data to a certain context, where I can define a consistent set of behaviors that will happen alongside that even every time it happens.
Please let me know your thoughts. Is this kind of program structure even viable in an Access application? Even if I'm way off base with my idea that OOP can help solve my two field situation, I'm still curious about the answers to my super general question at the top of this post, because I want to understand more the tools under my belt by seeing the clever ways others have used them.
Thanks a lot, as always! God bless!
I have more of a theoretical question today, I'm mostly looking for inspiration on how I might be able to take advantage of the OOP paradigm in the application I'm working on. I guess the general and very open ended question I have is this:
"Can I have some examples from fellow Access programmers of how you've utilized classes and OOP in your databases to write more effective and easy to maintain code? Is there even any such thing as coding using the OOP paradigm in Access?"
Here's What Lead Me to Ask This if It Seems Random...
This came into my mind as I was working on planning out some behavior for two different forms of mine. I realized that there's a field I want to be able to change on two different forms called "Due_Date". I also have a "Reminder_Date" concept in a different field, whenever the Due_Date field gets changed, I want to automatically change the Reminder_Date as well such that the days between them remain consistent. If I bump the due date up 5 days, the reminder date gets bumped up 5 days as well to maintain the distance between them. This is by no means hard to do, but to the best of my knowledge, I would have to write the same code in two places, or (better of course) have a subroutine that does this and gets called in two places.
The same subroutine getting called in multiple places isn't the end of the world, but what if in the future there's another form that changes the due date, and another? I would have to continuously remember to add calls to the subroutine or otherwise get inconsistent behavior throughout my application.
I sort of wish there was a way to define a protocol, every time I change the Due_Date field, independent of the form I changed it from, I want this behavior to occur.
I'm curious of there's some clever way to structure my codebase to allow for this kind of thing. Please, correct me if I'm wrong, because I am no OOP expert at all, but this is one of the many strengths of OOP that I think I understand, the ability to restrict access to changing data to a certain context, where I can define a consistent set of behaviors that will happen alongside that even every time it happens.
Please let me know your thoughts. Is this kind of program structure even viable in an Access application? Even if I'm way off base with my idea that OOP can help solve my two field situation, I'm still curious about the answers to my super general question at the top of this post, because I want to understand more the tools under my belt by seeing the clever ways others have used them.
Thanks a lot, as always! God bless!