I am used to develop Access forms (generally bound) in the very traditional way of writing code for all the controls that require them.
For instance, textbox containing a telephone number will check if the number is well formed in before_update (and, if not, Cancel=true and control.undo), whereas in after_update it will search for the number already being in other records (just for informational purposes)
If the form contains, 5 telephone number per person, I am mainiting very similar code 5 times, cluttering the form with code.
There are two immediate ideas to reduce or virtually eliminate so much code.
1) Declare a control of a certain "custom type or business object" (telephone number, say only Spainsh, for simplicity), and write validating code only once in that "type". Controls of that type automatically inherit the code, without any need to reference it
2) Write the events from code, using event handlers. It implies opening the form object, write on it and save it. A kind of batch process to run when creation/maintenance is needed.
May I receive some hints of that from people who has already experienced those paths, or others? Goal is to simplify code, typing and errors.
thanks
For instance, textbox containing a telephone number will check if the number is well formed in before_update (and, if not, Cancel=true and control.undo), whereas in after_update it will search for the number already being in other records (just for informational purposes)
If the form contains, 5 telephone number per person, I am mainiting very similar code 5 times, cluttering the form with code.
There are two immediate ideas to reduce or virtually eliminate so much code.
1) Declare a control of a certain "custom type or business object" (telephone number, say only Spainsh, for simplicity), and write validating code only once in that "type". Controls of that type automatically inherit the code, without any need to reference it
2) Write the events from code, using event handlers. It implies opening the form object, write on it and save it. A kind of batch process to run when creation/maintenance is needed.
May I receive some hints of that from people who has already experienced those paths, or others? Goal is to simplify code, typing and errors.
thanks