Resize main form and subform?

K

Kiers

Hi All,

i have form with a subform (datasheet view) with the 'border' property
of the main form set to 'sizeable', is it possible for the subform to
automatically resize in line with the main form? Currently the subform
size remains fixed, which distorts the whole form. the reason being, i
want my users to be have the flexibility of setting some form sizes to
meet their own requirements.

Any assistence will be appreciated.

(Access 2007)

Rgds

Kiers
 
D

Dirk Goldgar

Kiers said:
Hi All,

i have form with a subform (datasheet view) with the 'border' property
of the main form set to 'sizeable', is it possible for the subform to
automatically resize in line with the main form? Currently the subform
size remains fixed, which distorts the whole form. the reason being, i
want my users to be have the flexibility of setting some form sizes to
meet their own requirements.

Any assistence will be appreciated.

(Access 2007)


Yes, you can use the Resize event of the main form adjust the height and
width of the subform based on the current InsideHeight and InsideWidth of
the main form. For example:

Private Sub Form_Resize()

Me.sfMySubform.Height = Me.InsideHeight - 100
Me.sfMySubform.Width = Me.InsideWidth - 200

End Sub

Note that I've only actually done this to adjust the height of a continuous
subform. Tweaking the width may possibly involve some additional
adjustments; I can't really say.
 
F

FrozenJackal

Yes you can do this by selecting the sub-form and changing the Horizontal and
vertical Anchor Properties to "Both"
 
K

Kiers

Yes, you can use the Resize event of the main form adjust the height and
width of the subform based on the current InsideHeight and InsideWidth of
the main form.  For example:

    Private Sub Form_Resize()

        Me.sfMySubform.Height = Me.InsideHeight - 100
        Me.sfMySubform.Width  = Me.InsideWidth - 200

    End Sub

Note that I've only actually done this to adjust the height of a continuous
subform.  Tweaking the width may possibly involve some additional
adjustments;  I can't really say.

Hi Dirk,

thanks for your time.

Height adjustment works fine. Now encouraged to sort out the width and
also move 'buttons' (that are on the main form) as the form resizes.

Rgds

Kiers
 
D

Dirk Goldgar

Kiers said:
Height adjustment works fine. Now encouraged to sort out the width and
also move 'buttons' (that are on the main form) as the form resizes.

Very good. Good luck with it!
 
D

Dirk Goldgar

FrozenJackal said:
Yes you can do this by selecting the sub-form and changing the Horizontal
and
vertical Anchor Properties to "Both"


Neat! That's a new feature of Access 2007 that I wasn't aware of. If I
were Kiers, I'd give that a try in place of the code approach I suggested.
 
K

Kiers

Neat!  That's a new feature of Access 2007 that I wasn't aware of.  If I
were Kiers, I'd give that a try in place of the code approach I suggested..

Hi Again,

thanks for the responses. I got the subform to work. but not quite yet
for the controls. I think this is to do with the construction of the
form;

The main form has 4 pages, each page has its own subform. The controls
move as expected when the form size is increased, but they do not move
when the form size is decreased (horizontally). The controls
horizontal anchor is set to 'left' and vertical is set to 'bottom'.

Any suggestions would be appreciated.

Rgds

Kiers
 

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