Set Form height at Runtime Access 2007 Runtime

S

Sue L.

I want a fixed number of records in my detail section no matter the size of
the window.

I put:
Form.Section(acFooter).Height = Me.InsideHeight -
(Form.Section(acHeader).Height + numrows * Form.Section(acDetail).Height)

in my load event code. It works great when I am running the development
code, but when I run it in runtime the detail height is at the default height.

Any ideas?

Thanks
 
S

Sue L.

OK --- more information ----

When I put a ribbon on the form all is well. How can I figure out if there
is a ribbon displayed while in runtime? In a .accdb file there is always a
ribbon.

Thanks
 
M

Marshall Barton

Sue said:
OK --- more information ----

When I put a ribbon on the form all is well. How can I figure out if there
is a ribbon displayed while in runtime? In a .accdb file there is always a
ribbon.

The only way I can think of that code being useful is if the
form's footer section has nothing in it. The reason is that
the height of the detail area in a form is determined by the
form's InsideHeight minus the header and footer heights
(i.e. the detail area is whatever is left over after the
header and footer are displayed).

The only reason to adjust an empty footer is when the form
and Access are both maximized, so I conclude that the
ribbon/toolbar/menus are reducing the height of the Access
window, which in turn will cause the form to be shorter. If
there is not enough room to display that many rows then yor
calculated footer height can go negative and Access can not
do that.
 
S

Sue L.

I am unsing the footer to reduce the height of the details section in a
maximized view. In runtime, sometimes the ribbon is not there, and then the
details section is LARGER than it should be.

How can I tell if the ribbon is visible?

Is there a better way to specify the height of the total detail section
rather than mucking with the footer height?

Thanks,
Sue
 
M

Marshall Barton

Sue said:
I am unsing the footer to reduce the height of the details section in a
maximized view. In runtime, sometimes the ribbon is not there, and then the
details section is LARGER than it should be.

How can I tell if the ribbon is visible?

I hate using maximized windows and I haven't used A2007
enough to be familiar with the nuances of the ribbon so I
don't know the answer to that question. Not sure it would
help even if I did because I don't think the ribbon is
guaranteed to be the same height all the time or on
different machines with different screen resolutions and\or
sizes. To make matters worse, and this might be happening
in your case, the size of the available space for your form
can change after the code has run. I.e. the ribbon did not
appear until after the form was opened, which then caused
the form's height to be reduced or increased.
Is there a better way to specify the height of the total detail section
rather than mucking with the footer height?

Because things can be different in all kinds of ways, I
think you would have to add a bunch more code to try deal
with the myriad variations that might exist when your form
is used. The first thing is to check the form's
InsideHeight to see if that many details will fit and bail
out if they won't. Even then, don't forget that things can
change AFTER the form is opened.

Because you have no control over the size of a maximized
form, I really doubt that it is possible to deal with the
general case and strongly recommend that you not use a
maximized form. If the form were not maximized, you could
set the form's InsideHeight to accommodate the 13 details
(with no footer?) and let the scroll bar deal with a too
small Access window. If some users decide to maximize the
form, they are also taking responsibility for dealing with
the appearance of the form.
 

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