If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. |
|
|
Thread Tools | Display Modes |
#1
|
|||
|
|||
General question about naming conventions for forms
As I am building this application, I am trying to put it together in a
way that will reduce as much as possible any headaches that come when trying to modify it in the future. So one of the things I am thinking about is the way forms are opened and handled in Access. When I transfer control to other forms, I need to refer to that form, of course, and that's done by providing the form's name in a string. There are some forms that I am creating as general forms and they will be called from many different forms. So, if I decide down the road to change the name of a form (for some reason) then to get things to work correctly I will need to go to every place that I have hard-coded the old name of the form and I will have to hard-code the new name. I was thinking that instead of doing this I would declare each form name in a MAIN or GENERAL module. I would declare each form name as a global string constant. Then I use the global string constant throughout the application. If I ever need to change the name of a form then I need to change it in only one place - the declaration for the global string constant. But I was wondering if this will buy me anything. Will this save me the time and headache I am hoping it will save? Or is this not a good practice? As you can probably tell, I am new to programming in Access (been doing it about three weeks now) and I am not sure if there are some "lessons learned" that are out there. If this is a bad idea, please let me know. Or if this is a good idea, let me know that also. |
#2
|
|||
|
|||
"Mister John Doe" wrote in message
news As I am building this application, I am trying to put it together in a way that will reduce as much as possible any headaches that come when trying to modify it in the future. So one of the things I am thinking about is the way forms are opened and handled in Access. When I transfer control to other forms, I need to refer to that form, of course, and that's done by providing the form's name in a string. There are some forms that I am creating as general forms and they will be called from many different forms. So, if I decide down the road to change the name of a form (for some reason) then to get things to work correctly I will need to go to every place that I have hard-coded the old name of the form and I will have to hard-code the new name. I was thinking that instead of doing this I would declare each form name in a MAIN or GENERAL module. I would declare each form name as a global string constant. Then I use the global string constant throughout the application. If I ever need to change the name of a form then I need to change it in only one place - the declaration for the global string constant. But I was wondering if this will buy me anything. Will this save me the time and headache I am hoping it will save? Or is this not a good practice? As you can probably tell, I am new to programming in Access (been doing it about three weeks now) and I am not sure if there are some "lessons learned" that are out there. If this is a bad idea, please let me know. Or if this is a good idea, let me know that also. I would say it is a good idea if it coincides with a bad practice which is to make a habit of changing the names of your forms. This should be so rare an event that your good idea becomes unnecessary. In other words, if you add the additional up front work and run the risk of making your code a bit harder to understand by doing this only to find out a year or two from now that you only ever changed the name of a form once or twice, then it was a waste of your time. However; if you find afterwards that you are changing the names of your forms a LOT, then it will look like the best idea you ever had. -- I don't check the Email account attached to this message. Send instead to... RBrandt at Hunter dot com |
Thread Tools | |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
General Question | LEWIS MCEWEN | Outlook Express | 5 | August 22nd, 2004 02:16 PM |
general query question | Kevin S. | Running & Setting Up Queries | 4 | August 6th, 2004 09:01 AM |
General question on Access Database Structure | Mike | New Users | 3 | July 8th, 2004 05:56 PM |
general cell question | JohnE | New Users | 3 | June 17th, 2004 05:33 PM |
Sumproduct or Countif question --- multiple criteria | Ken Wright | Worksheet Functions | 4 | October 28th, 2003 10:08 AM |