Controling two forms in tandem

J

John Keith

I have a main list form that shows a row for each school with a total recipts
column. The detail on this form is continuous and clickable to launch into a
detail data edit form. The form header has some selectable drop down
controls to pick a period (all of my queries and reports use this period to
select/filter data). The Form footer has about 8 command buttons to take a
period's data for each school and run various processes/reports. The
placement of the buttons in the footer are crowded and this forces the detail
section to be sized smaller to fit on the screen.

I want to create a 2nd form to house the buttons.
I want to make both forms move and size with each other as a pane of
form-windows.
I want to make opening/closing of either form do the same for the other form.
I need to set a smallest allowed height/width for each form and reset to
that size if a resize operation tries to make it too small.

Which are the proper form-events that should contain the code?
* Open → Load → Resize → Activate → Current
* Unload → Deactivate → Close
Since resizing could trigger another resize, I need to make sure I avoid any
cascading event loops.

I plan on making the Button form be the left most form and sized tall and
narrow with the buttons grouped in a top-to-bottom line. The main list form
would stay positioned to the right of the buttons form and have the same
height. (a min height would be just enough so that all of the buttons remain
visible)

I plan on using the Left, Top, Height and, Width properties to size and
position the form windows.
Any pit-falls to watch out for?
 
M

Marshall Barton

John said:
I have a main list form that shows a row for each school with a total recipts
column. The detail on this form is continuous and clickable to launch into a
detail data edit form. The form header has some selectable drop down
controls to pick a period (all of my queries and reports use this period to
select/filter data). The Form footer has about 8 command buttons to take a
period's data for each school and run various processes/reports. The
placement of the buttons in the footer are crowded and this forces the detail
section to be sized smaller to fit on the screen.

I want to create a 2nd form to house the buttons.
I want to make both forms move and size with each other as a pane of
form-windows.
I want to make opening/closing of either form do the same for the other form.
I need to set a smallest allowed height/width for each form and reset to
that size if a resize operation tries to make it too small.

Which are the proper form-events that should contain the code?
* Open ? Load ? Resize ? Activate ? Current
* Unload ? Deactivate ? Close
Since resizing could trigger another resize, I need to make sure I avoid any
cascading event loops.

I plan on making the Button form be the left most form and sized tall and
narrow with the buttons grouped in a top-to-bottom line. The main list form
would stay positioned to the right of the buttons form and have the same
height. (a min height would be just enough so that all of the buttons remain
visible)

I plan on using the Left, Top, Height and, Width properties to size and
position the form windows.


It's doable, but messy. You also have to guard against the
main form being moved left past the point where there isn't
enough room for the button form. I think you need to use
the WindowLeft/Top and InsideWidth/Height properties.

Since you have room on the screen to display both forms, I
would try real hard to avoid all that by creating an unbound
bound form that is only used as a container and placing both
of your forms on it as subforms. Actually you could
probable get away with putting the buttons on the unbound
form and only having the data form as a subform. You would
still need to deal with the resize issue but IMO it's a lot
simpler than coordinating two separate forms.
 
D

Daryl S

John -

If I read your problem correctly, I think there may be a simpler solution.
It sounds like you would like to 'move' your buttons to the left of the
subform so you can display more rows of data in your subform. What about the
following approach?

1. Resize your subform in the main form to be narrower and taller.
2. Hide the form footer or shrink the 8 controls in the footer until they
have almost no height or width so you can shrink the footer to almost nothing.
3. In the main form, since you have made the subform narrower, use the new
space to the left of the subform to add 8 controls that look like the old
ones you had in the subform. The code behind these new controls would just
run the code behind the real controls in the footer of the subform.

This means you won't need to worry about trying to keep two forms in sync,
and you won't have to re-code anything.

Hope this helps!
 
J

John Keith

Thanks for the repsonce..

I have found the code at http://www.mvps.org/access/forms/frm0042.htm
that does what was asking for.. except: The simple act of moving a form
with the mouse does not seem to fire off any event that I can trap and then
call the code to rebuild the control panel (I was seeing an app with lots of
forms all positioned based off each other)...And it is very messy to deal
with that kind of code.

The subform idea is a way to do what I need, Thanks for the suggestion.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top