I have several forms, each having multiple pages. For example, my StudyGroups form has a Members page showing members in each study group. there may be other pages. each page is powered by a DataView. They use join tables and selected tables.
These forms call InitSelectedTables function which, using saved metadata, refreshes the Selected… table with defaults stored in the respective join table. This function makes use of various libraries. So far, everything is working ok.
Now one of my forms needs to run code to set some form fields. For example, my GenerateEmails form, in addition to running InitSelectedTables needs to run a library called GetEmailDefaults, which will read the bound fields DefaultSubject and DefaultBody (they are hidden on the form) and use those values to update the unbound fields Subject and Body.
At first I thought I’d put qualifying code in InitSelectedTables function such as “if this form is ‘GenerateEmails’, then call this library. But this seemed cumbersome, and the function will get bigger and messier.
So I tried copying this function code and making it into a library instead. Then created a new function called FormShow, which would call the InitSelectedTablesLib library and optionally also call the GetEmailDefaults library.
Then I changed the OnShow event of one form to instead run the FormShow function. So now I get this:
Am I trying to do too much, and should I just put special conditions in the InitSelectedTable function to sometimes call the library? Thanks…
