Solved How to change footer hight dynamically? (1 Viewer)

Sun_Force

Active member
Local time
Today, 22:11
Joined
Aug 29, 2020
Messages
397
I have a textbox in the footer of a report and it shows a multi line text as a note.
In some cases, I need to hide the textbox and give more room to details section to print more rows.

I tried the following in report's on-Open event but it seems it has no effect.
Code:
 if (my condition) then PageFooterSection.Height = 10

How do you change footer section height dynamically?

thanks for any kind of advice.
 

arnelgp

..forever waiting... waiting for jellybean!
Local time
Today, 21:11
Joined
May 7, 2009
Messages
16,077
maybe add the condition on the Detail Section's Format event?
 

The_Doc_Man

Immoderate Moderator
Staff member
Local time
Today, 08:11
Joined
Feb 28, 2001
Messages
22,491
The problem with your request is that the footer is formatted AFTER the detail section. (The page goes from top to bottom.) Therefore, you have to pick a condition that is predictable BEFORE the footer is even started. Do you have such a condition? I.e. is there something you can check during the detail section that would predict the size of the footer? If not, I think the answer to your question is "You can't."
 

Sun_Force

Active member
Local time
Today, 22:11
Joined
Aug 29, 2020
Messages
397
The problem with your request is that the footer is formatted AFTER the detail section. (The page goes from top to bottom.) Therefore, you have to pick a condition that is predictable BEFORE the footer is even started. Do you have such a condition? I.e. is there something you can check during the detail section that would predict the size of the footer? If not, I think the answer to your question is "You can't."

I open the report with a openarg.
The openArg contains a filter, and some other options to print the report based on the given filter and logged in user options.
It means that I'm able to extract the condition from the openArg and any event of the report.

I will check to see if I can make it work in Detail or footer on format .
Thanks for your suggestion.

I was just wondering what will happen to the textbox. I mean I was curious to see if it's possible to change the height of the footer, because a textbox is sitting there and even if empty, it occupies the space.

I will check and come back.
thanks again.
 

The_Doc_Man

Immoderate Moderator
Staff member
Local time
Today, 08:11
Joined
Feb 28, 2001
Messages
22,491
Normally I would point to the .CanGrow and .CanShrink properties, but you are looking a modification of the .Height properties on multiple objects including textboxes and sections, some of which might not have auto-resize capabilities.
 

Sun_Force

Active member
Local time
Today, 22:11
Joined
Aug 29, 2020
Messages
397
Seems that Neither detail nor footer on format event can do the magic. (or at least I couldn't make it work)

Possibly because as I had guessed, the textbox i sitting there and occupies some space. So it seems even if I hide the textbox, the footer can not be less than the height of the textbox.
 

Sun_Force

Active member
Local time
Today, 22:11
Joined
Aug 29, 2020
Messages
397
Normally I would point to the .CanGrow and .CanShrink properties, but you are looking a modification of the .Height properties on multiple objects including textboxes and sections, some of which might not have auto-resize capabilities.
Doc, thanks for the hint. I will work on cangrow property to see if I can use that.
 

Sun_Force

Active member
Local time
Today, 22:11
Joined
Aug 29, 2020
Messages
397
@The_Doc_Man
I'm terribly sorry to ask this.
Does Doc in your handle name mean Doctor? Do you have a PHD?
Anytime I see your name in a post, I can't think of anything else than a PHD.
 

arnelgp

..forever waiting... waiting for jellybean!
Local time
Today, 21:11
Joined
May 7, 2009
Messages
16,077
can you use the Report footer?
EDIT:
see if you can tweak this report. it only check if the "line count" is already >=31.
 

Attachments

  • page_footer_show_hide.accdb
    424 KB · Views: 208
Last edited:

The_Doc_Man

Immoderate Moderator
Staff member
Local time
Today, 08:11
Joined
Feb 28, 2001
Messages
22,491
@The_Doc_Man
I'm terribly sorry to ask this.
Does Doc in your handle name mean Doctor? Do you have a PHD?
Anytime I see your name in a post, I can't think of anything else than a PHD.
Ph.D in Analytical Chemistry, 1975, Univ. of New Orleans

Note that date when considering my early story. My dissertation included use of a computer directly connected to a spectrophtometer to do a chemical kinetics study - watching the progress of a reaction that changed color - as a way to analyze the reaction mechanism. If you review the literature of the time, you would recognize that I was in the second wave of on-line process monitoring (the first wave being about mid-1950s). This makes more sense if you realize that my first "real" job was in a process-control-and-monitoring company that supplied specialty computer systems to the oil and gas industry in south Louisiana. I was their acquisition device driver specialist and formulas guy.

I got out of that industry in the mid-to-late '80s when the Gulf of Mexico oil and gas industry migrated to Houston and due to family illness, I could not follow. So I became an applications programmer and system analyst. Thirty years later, I retired as a system analyst and administrator for the U.S. Navy, with security and O/S certificates and a lot of experience.
 

CJ_London

Super Moderator
Staff member
Local time
Today, 14:11
Joined
Feb 19, 2013
Messages
14,170
the textbox i sitting there and occupies some space. So it seems even if I hide the textbox, the footer can not be less than the height of the textbox.

Hiding the textbox will have no effect. Set the height of the textbox to 0 and the cangrow property to true. And reduce the height of the detail section to 0 (it will then shrink to the minimum it can be given controls in the section)
 

Sun_Force

Active member
Local time
Today, 22:11
Joined
Aug 29, 2020
Messages
397
@arnelgp @CJ_London
Thanks for your help. Now that the problem is solved I feel being stupid not to think of playing with the textbox height too.
You're genius.

@The_Doc_Man
You have a story to tell for your kids and grand children. They should be proud of having someone like you in the family.
I hope my future kids feel the same about me. I think I should study harder, not to set my goals only to pass the tests and not to use the pandemic as an excuse for the poor results.
 

Users who are viewing this thread

Top Bottom