In one of my projects I needed to display several forms of the same type beside each other. It was a kind of a dashboard showing information about one project per form. One approach could have been to display several subforms on one main form -- but the problem was that the output should be shown on a video projector with as much as possible usage of the whole form and the number of projects to display should be variable, from one to five.
So, my first idea was to work with what Access does use itself: A function to tile windows horizontally or vertically which is possible with simply calling these functions:
works fine and one could be satisfactory -- but there are some issues with these functions:
it tiles in the desired direction only up to three windows; with more it can happen that Access decides itself if the next window will be tiled vertically or horizontally
the border setting of the forms must be "sizeable"; otherwise these functions doesn't work correctly and with "none" they doesn't work at all
the form mustn't be a popup form; such forms are not affected by these functions.
So in the end I needed to write an own procedure
to tile windows horizontally or vertically and additionaly use the maximum window size.
The attached TileForms.zip
demo database file shows the result. The form "frmStart" only exists to open five forms of the same type, the form "frmTest". This was designed as popup form but it is also possible with normal forms if the database is not set to tabbed forms. The border can be sizeable and you can also use forms with no borders so if they are tiled it looks like one screen (and the user cannot close the single forms).
If the close button is active you can also close one form and call the tile function again and it will use only the remaining forms in the collection.
The sub "TileCollection" can be called with any collection which contains form objects. This gives you the full control over which forms are tiled and which are not. The module "modTile" already has a public collection "colForms" which can be used but you can of course use additional own
The measurement is done by opening the first valid form in the collection and maximizing it. This shows the available size on the screen and this is used to tile the forms horizontally or vertically depending on the chosen option.
The sub "OpenForms" is meant as demo code and not as the generic method for all forms because it uses the specific "Form_frmTest" type to open the form "frmTest" five times. Depending on what you want to do you must write your own code to fill a collection with form objects in the shown way. That can be, like here, x times the same form or you can also open x forms and set their form reference into a collection, like you want.
In the shown approach the form should be opened as object and in this case you need to specify an exact class module name which is "Form_frmTest" in this case. This class module name only exists if you set the "HasModule" property of the form to True (or if like in this case the form contains code, this will automatically set this property).
The sub "CloseForms" closes all forms in the collection and reinitializes the collection to a new one. This works generically so you can use it with any own collection.
The subs "HideAllMenus" and "ShowAllMenus" are there to hide the ribbon bar and the navigation bar of A2007 and show them again. This is not forcibly needed; if your forms are designed as popup it doesn't make a difference as the full screen will be used. If you have normal windowed forms they are MDI forms in the Access application window and in this case you can get the maximum available size inside the Access application window using the Hide and Show subs.
(The first object of each category will also be hidden and so the "frmStart" form also disappears. You must set it to visible again if you do not want that.)
With fnLastWindow you can test if the collection contains only one valid form. If this is the case the "CloseForms" sub can be called in the Unload event of the form to make sure the menus will be displayed and the collection will be erased. Otherwise you maybe end with an empty application window without use.
As you can see in the "frmTest" form the code needed to maintain the tiling is very short. The code was developed and tested with A2007, also with the runtime version, and works since a year in the mentioned project to display project informations with a video projector side by side in a production department to show the current status of the production of each project for the employees working there.
Have fun in experimenting with it.