Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Hide controls & change detail height in report

Status
Not open for further replies.

sue84

Instructor
Apr 13, 2003
4
CA
Hey! I have a report whith ten text fields and ten group boxes. The numbers of fields and boxes to show depends on the value of a variable. I use the onformat property to hide and show the correct amount. This works fine but the heigt of the detail section should adjust to the numbers of controls that are shown. I have tried to move them (.top, .left) and used twips to have them in correct places but it dosen't work. Also tried to use the retreat property but I am not sure on how to use it. Grateful for any tips. Sue84
 
I take it that you are trying to show them vertically in a column. You want the conrol to show when there is data but now to take up space if there is not. Well here is the answer. It is quite simple but it works great.

Create your controls making in your vertical arrangement. Now select them all and right click the selection and select properties. The height of all of them should be changed to 0. That's right ZERO(0). Now change the Can Grow property to Yes. Close the properties window.

The next step while they are all selected(yes, they all look like hairlines, that's okay), click the Format menu item, select Vertical Spacing and Decrease. Keep doing this until they are all bunched up together and look like one single line. Make sure they are moved to the top of the Detail Section, nice and tight. You can now slide the bottom of the Detail Section right up to the bottom of the lines. Doesn't look too good right now does it.

Well when you run the report each control will expand to the necessary height given the font selected if there is data for it to display. If not it just stays a 0" height control never to be seen.

Hopefully this is what you were looking for.

Bob Scriver
 
This works fine with text boxes but how to do it with group boxes since they dont have the property can grow?
 
What do you mean by the term "Group Boxes". If you are talking about text boxes at a Group Header then yes they do have the Can Grow property. I need you to explain these Group boxes and exactly how you want everything displayed. Maybe we can come up with something that will work.

Bob Scriver
 
Group boxes - in a form mark (for example) one of three and on a report the process is inverted. I am not sure of the english word for that type of input box. But they don't have the properties can grow or can shrink. The report I am trying to do works fine if only one detail is formatted, the controls end up where they should and I get the correct height of the detail section but when there is another post to be added to the report and the format routin is run one more time, it dosent work. The error message says "not enough space for the control". I have tried to use on_retreat but so far with poor result. How do one use on_retreat?
 
You must be talking bout a List box control or combobox control. These controls do not have the Can Grow property.

I see you problem but i don't have an answer for you yet. If you would like to pkg. up a DB with the report and some sample records and send them to me (see email in my profile ) I would be glad to take a look at it.

Bob Scriver
 
The report is quite straightforward. It is based on a query and I have put the controls in correct position. The controls are ten textboxes and ten option groups, and it is a vertical arrangement. A select case statement looks for a variable (0 -10) and shows the correct amount of controls. Every time the select case fires a new post is added to the report. All controls are hidden when the report formats. Controls that are not to be shown are moved to the top of the details section (using Me.txtbox1.top=0 and so on). It works fine with just one detail but when the code runs twice or more it dosen't work. The final height of every case is not set until the end of the case. Every case starts with more space then needed. It puzzles me and would be very grateful if someone could show me the right direction where the answer might be.
 
I am sorry but I don't have any other ideas at this point. I will keep thinking about it.

Bob Scriver
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top