Resize Form Footer with code?

N

niuginikiwi

Hi,

I have a continuous form that displays a whole bunch of records in the
detail section.

In the header of the form I have a checkbox called chkShowFooter.
Ideally, I would like the form to have zero footer on open or on load but
when the chkShowFooter is ticked or checked, I would like the footer to
resize to say about 2 centimetres and when unchecked, the footer resizes to
zero.

I am sure it can be done but I dont know who to do it. Any help is much
appreciated.
 
N

niuginikiwi

I ended up putting this bit of code in the afterupdate event of chkShowFooter
but that doesn't appear to have anything happening when I check/uncheck the
checkbox.

Private Sub chkShowFooter_AfterUpdate()
If Me.chkShowFooter = True Then
Me.FormFooter.Height = 2
Else
Me.FormFooter.Height = 0
End If
End Sub

Also I didn't mention in my original question that I have some unbound text
fields on the Form Footer.

Any suggestions?
 
M

Marshall Barton

niuginikiwi said:
I have a continuous form that displays a whole bunch of records in the
detail section.

In the header of the form I have a checkbox called chkShowFooter.
Ideally, I would like the form to have zero footer on open or on load but
when the chkShowFooter is ticked or checked, I would like the footer to
resize to say about 2 centimetres and when unchecked, the footer resizes to
zero.


Try this kind of code:

Private Sub chkShowFooter_AfterUpdate()
If Me.chkShowFooter = False Then
Me.Section(2).Visible = False
Me.InsideHeight = Me.InsideHeight -
Me.Section(2).Height
Else
Me.InsideHeight = Me.InsideHeight +
Me.Section(2).Height
Me.Section(2).Visible = True
End If
End Sub
 
N

niuginikiwi

Thank you Marshall,
That worked perfectly fine. It was a copy and paste.
Thanks,
 
M

Marshall Barton

niuginikiwi said:
Thank you Marshall,
That worked perfectly fine. It was a copy and paste.


You're welcome.

The reason your attemot did nothing is the Height of a
section can not be reduced above the lowest control. Making
it invisible allows the form's size to be reduced without
eating into the details space.

An alternative to making it invisible is to set the Top and
Height of all the footer controls to 0 before setting the
footer's Height to 0. This is a real pain, especially when
you consider resetting the Top and Height of all that stuff.
 

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