Move an Object from Form Detail to Header in Code (1 Viewer)

isladogs

MVP / VIP
Local time
Today, 05:51
Joined
Jan 14, 2017
Messages
18,235
Many thanks for your suggestions Isaladogs, much appreciated. I have looked at the MS Application Parts and their templates on and off in the past without feeling any affinity, or interest in adapting any of their work or designs. Actually, their designs leaves me cold, too simplistic and often of little practical use. Plus, I'm pretty much anti-macro, preferring Functions to macros every time.

After using Access since A97, in common with many others no doubt, I have developed my own design, look and feel. Which I do prefer of course, but am always open to include new ideas, or a different way of doing the work. Particularly if it reduces development time!

However, I take your point and will from time to time check your website with some interest for the update on your new Application Parts.

I agree totally. The various database templates are mostly poor and the built-in application parts even more so.
So much so, that most experienced developers including myself avoid them completely

However, what is less well known is that you can create your own database templates and application parts to include objects that you want to re-use regularly. Whilst you can, of course, just import such objects from another database, templates & application parts can be a much more convenient and powerful approach

I have just published the article I was referring to. I hope it will give you and other members some ideas for their own use

It is something I promised @jdraw that I would do about 6 months ago. . . it finally reached the top of my list
 

Pat Hartman

Super Moderator
Staff member
Local time
Today, 00:51
Joined
Feb 19, 2002
Messages
43,293
I do not use the same form for multiple purposes
Except that you have code that runs at RUNTIME every time the form opens and it somehow has to figure out where you want the controls so there is If logic in the code. Your code is not running at design time UNLESS you run it once for the copied form to move the object. Then save the form and disable the code.

I almost never use custom navigation controls, BUT when I do, I use the subform method suggested by MajP. I haven't changed the code for this subform in years. That's the good thing about actual reusability. Although, I sometimes have to modify the colors if I don't like the ones in the theme the user likes. But, I only have to do that ONCE on the subform.

@isladogs back when A2007 first came out, I played with making application parts and templates. The problem is that I just don't reuse objects from application to application except for a couple of mini-apps like my lookup list maintenance app. So, I just ended up leaving them in a database and importing from there.

I never use the MS made objects because I don't like their naming standards or the fact that they use macros.
 
Last edited:

isladogs

MVP / VIP
Local time
Today, 05:51
Joined
Jan 14, 2017
Messages
18,235
@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:

MajP

You've got your good things, and you've got mine.
Local time
Today, 00:51
Joined
May 21, 2018
Messages
8,529
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

  • FromToList V9.accdb
    2.9 MB · Views: 61

Users who are viewing this thread

Top Bottom