Using a Form Template (1 Viewer)

LtWorf33

New member
Local time
Today, 18:04
Joined
May 14, 2020
Messages
11
After building my project for a while, I am coming to the realization that I am going to be viewing multiple forms but I want all of them to be formatted the same. Is it possible to build one 'unbound' form template, and then populate the form using a conditional or a query?
 

theDBguy

I’m here to help
Local time
Today, 15:04
Joined
Oct 29, 2018
Messages
10,003
Sure. It all depends on how much work you want to put in setting it up. Rather than create a dynamic source form, an easier approach might be to create a blank form and set it up with the look you want and then simply make a copy of it for every data form you need.
 

Uncle Gizmo

Nifty Access Guy
Staff member
Local time
Today, 23:04
Joined
Jul 9, 2003
Messages
11,437
After building my project for a while, I am coming to the realization that I am going to be viewing multiple forms but I want all of them to be formatted the same. Is it possible to build one 'unbound' form template, and then populate the form using a conditional or a query?
I'm not quite sure I'm on the same wavelength as you, but I thought I should mention, a common mistake people make is they create a form for entering customer data, then make a copy of that form for searching customer data, then make another copy for editing customer data. You can end up with multiple forms with slight differences in the way they operate. It is possible (and desirable) to create one form that will do all three functions, just modify it slightly with VBA code.
 

The_Doc_Man

Happy Retired Curmudgeon
Local time
Today, 17:04
Joined
Feb 28, 2001
Messages
16,760
I did something like you ask in one of my projects for the U.S. Navy. I ended up having to build two templates.

One of the templates was a review-only form and you had search/report capabilities on it. Another was a table maintenance form that would focus on a single table. A third was a special type of action form that had built-in filtration using multi-select combo lists. In essence, what I did was decide what controls I was going to have on each form that was going to be in common with other forms in the same class of action. I put all of the common parts on the templates.

For the one that was going to be used for table-content editing, I had command buttons for Close, Create, Delete, Commit, Cancel, and one to pop up a separate "File Trouble Report" form. The buttons would appear and disappear based on the forms being in a particular state that was part of the Form's Class Module data, and I had a few control "sweep" routines that would paint controls according to those states and the current focus. The template was unbound but it was fully instrumented with things for form events like _Open, _Load, _Current, _BeforeUpdate, _Close, and a few other event handlers.

Obviously, until I made a copy of that template and bound it to a table, there were no data fields, but I had things like date, time, username, user role, and a set of user privilege references. (The privileges and other use data were loaded by the opening form, which was a type of switchboard.) I'm going to estimate that by doing one template first and then just filling in the copies, I was able to save about 40% of the work PER FORM. And, it was each to go back and retrofit because the templates were pretty much ready to go.

It was a little bit of work up front, but having the templates made maintenance easy for the innumerable little "translation" tables that I had throughout the DB. It was worth it. I should also note that counting 5 main tables and about 20 translation tables, I used the "single-table update" template a LOT. The others, less often.
 

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Top Bottom