Move an Object from Form Detail to Header in Code

@Pat Hartman
I never use the MS templates for all the same reasons.
Apart from poor naming & embedded/saved macros, they also use MVFs / attachment fields, table level lookups etc...etc.
Apart from all that I suppose, it could be said they aren't too bad 😉

The built-in application parts are equally poor. Also, personally I dislike layout guides

So all of the above has given both features a bad name.
However, the point of the article is that you can use them for your own purposes and save a lot of time.
Sure, you can import objects from one db to another . . . I've been doing that for years ... but as I re-use certain code, tables, forms & reports in many if not all of my apps, these two features can be a much more powerful alternative

You mentioned A2007.
I've just re-checked: although that had a limited set of table templates, Application Parts weren't added until A2010 and Templates were made easier to utilise in the same version
 
Last edited:
I use the subform method suggested by MajP
Just to reiterate one more time so that others do not miss the purpose of that post. That demo was NOT meant to demonstrate navigation controls. It is to demonstrate different ways to centralize and encapsulate your code. The navigation buttons was just for demonstration.
A third and most common method would be to put the methods in a standard module and pass the form reference.

Here is a more advanced version demonstrating the subform concept that uses a subform to act as a single control. A From To List. It is demoed on many forms doing different things. But the code is written once in the subform.
There is a lot going on. The buttons enable and disable as appropriate. You can select one item or all items. Use the buttons or double click. If you want this functionality to pick from a list simply drop the subform on any form. Then pass in the recordsource for the listbox/s.
FromTo.jpg


DISCLAIMER. This demo is to demonstrate the concept of encapsulating functionality of multiple controls within a subform. Then being able to drop the subform on to any form and use the functionality. It is not intended to demonstrate the best method to create a From To List type control.
 

Attachments

Users who are viewing this thread

Back
Top Bottom