Dynamically set height of subform depending on # records?

G

Guest

I need to display a subform (containg hyperlinks). In 99% of cases the
subform will display 0,1 or 2 records. I'd like to set the height on load to
accomodate the existing rows allowing room for the new record slot. The
subform is a continuous form. What is the best way to do this?
 
J

Jeff Boyce

Are you sure you want to risk having the subform disappear off the bottom of
the screen? Making the size of the subform vary with number of records
could, in one of your 1% situations...

Another approach is to set a size for the subform control that accommodates
many/most of your situations (sounds like 2 records), but leave the vertical
scroll bar enabled so the users can scroll down if there are more than 2
records.

Regards

Jeff Boyce
Microsoft Office/Access MVP
 
G

Guest

It wont happen because the code is controlled by a SELECT CASE which has a
CASE ELSE setting the height to the maximum displayable.
I only want to set the height as appropriate for 0,1 or 2 records.
 
J

Jeff Boyce

Then I'd first take a look at the properties of the subform control on the
main form. I suspect there's a combination of the Left, Top, Width and
Height properties you could set via code, having first counted the number of
rows that are related to your main form selection...

Regards

Jeff Boyce
Microsoft Office/Access MVP
 

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