Hi, folks.
I'm using a list box to display a list of forms. The form name displayed needs to be a bit more descriptive than the form name of the object that's actually going to be loaded, so I've stored the name to display and the associated form name to load in a database that's easy to update.
The application is constantly being expanded by adding new forms, and I'm trying to keep code maintenance to a minimum -- so I'd like the program to automatically find new forms every time it's started, and to find a match between a new form and its name as stored in the database.
As long as the name of the form object in the database is correct -- that is, if it matches perfectly the name of a new form -- the program should, theoretically, load the form.
However, the name stored in the database is a string, not a true object reference, and I can't figure out how to make the string into a valid object reference that actually causes a form to be loaded.
The only way I've been able to make this work is the "brute force" method, where I add a new explicit object reference each time a new form is created, but this requires adding explicit object references every time a new form is created.
I've tried using the "SET" command, passing the string name of the form in the database to an object variable, but this either doesn't seem to work, or the way I'm using it is not correct.
I'm just looking for a more "elegant" way to do this on the fly, so I can just create the new form, add its descriptive name and the associate object name to the database, and let the program find the form with the same (object) name on its own, without having to add an explicit object reference to the code every time I create a new form.
In other words, an algorithm for finding and loading new forms, starting with nothing more than a string name of the form, rather than using the "brute force" method.
Anyone have some experience with this?
Thanks so much. Your help, as always, has been invaluable.
Respectfully,
GWhiz
I'm using a list box to display a list of forms. The form name displayed needs to be a bit more descriptive than the form name of the object that's actually going to be loaded, so I've stored the name to display and the associated form name to load in a database that's easy to update.
The application is constantly being expanded by adding new forms, and I'm trying to keep code maintenance to a minimum -- so I'd like the program to automatically find new forms every time it's started, and to find a match between a new form and its name as stored in the database.
As long as the name of the form object in the database is correct -- that is, if it matches perfectly the name of a new form -- the program should, theoretically, load the form.
However, the name stored in the database is a string, not a true object reference, and I can't figure out how to make the string into a valid object reference that actually causes a form to be loaded.
The only way I've been able to make this work is the "brute force" method, where I add a new explicit object reference each time a new form is created, but this requires adding explicit object references every time a new form is created.
I've tried using the "SET" command, passing the string name of the form in the database to an object variable, but this either doesn't seem to work, or the way I'm using it is not correct.
I'm just looking for a more "elegant" way to do this on the fly, so I can just create the new form, add its descriptive name and the associate object name to the database, and let the program find the form with the same (object) name on its own, without having to add an explicit object reference to the code every time I create a new form.
In other words, an algorithm for finding and loading new forms, starting with nothing more than a string name of the form, rather than using the "brute force" method.
Anyone have some experience with this?
Thanks so much. Your help, as always, has been invaluable.
Respectfully,
GWhiz