Solved

Hidden field labels keep report section from shrinking

Posted on 2004-09-17
7
417 Views
Last Modified: 2011-09-20
I have a report in which I'm using the following to hide labels if a field is empty:

If IsNull(Phone) Then
    PhoneLabel.Visible = False
Else
    PhoneLabel.Visible = True
End If

I have this set for several fields and it works great to hide those labels if there are no contents in the field, however the end result is a lot of white space before the start of the next report section, even though I have everything set to Can Shrink. The labels don't have that option, so what do I do to get them to not keep the detail section from shrinking to only the fields that contain data?

Thanks.
RWW
0
Comment
Question by:PstWood
  • 3
  • 3
7 Comments
 
LVL 65

Assisted Solution

by:Jim Horn
Jim Horn earned 50 total points
ID: 12086358
The only option I can think of would be to shove as much of this stuff towards the bottom of the section, then use VBA code to set the .Height property as high as possible when certain fields are blank.

Otherwise, I bet this is covered in Crystal Reports.

Hope this helps.
-Jim
0
 
LVL 15

Accepted Solution

by:
will_scarlet7 earned 50 total points
ID: 12086400
Hi Richard,
Are you asking how to shrink the detail section to avoid the blank space when there are empty fields? If so I think you can use the Top property of the controls to move them highter when visible is set to False and the height property of the detail section to shrink it.
0
 

Author Comment

by:PstWood
ID: 12087007
Thanks, Jim & "Will"
0
Backup Your Microsoft Windows Server®

Backup all your Microsoft Windows Server – on-premises, in remote locations, in private and hybrid clouds. Your entire Windows Server will be backed up in one easy step with patented, block-level disk imaging. We achieve RTOs (recovery time objectives) as low as 15 seconds.

 
LVL 15

Expert Comment

by:will_scarlet7
ID: 12087110
Hope it was a help. ThanX for the points!

God bless!

Sam
0
 

Author Comment

by:PstWood
ID: 12087418
Well, I thought that would do it, but then I hit another snag. I have the following in my report onformat event:

If IsNull(Fax) Then
    FaxLabel.Visible = False
    FaxLabel.Top = 0
    FaxLabel.Height = 0
Else
    FaxLabel.Visible = True
    FaxLabel.Top = 0.5417
    FaxLabel.Height = 0.25
End If

The problem is that when the field is not empty, the label still doesn't show. If I remove the Top and Height stipulations, it works fine, but doesn't collapse when the Fax field is empty. Anyone have a solution?

Thanks.
RWW
0
 
LVL 15

Expert Comment

by:will_scarlet7
ID: 12087497
Richard, I think it may be that Access uses TWIPS as it's standard measurement when setting it in code. I think one inch is 1440 TWIPS, so it might work better like this:

If IsNull(Fax) Then
    FaxLabel.Visible = False
    FaxLabel.Top = 0
    FaxLabel.Height = 0
Else
    FaxLabel.Visible = True
    FaxLabel.Top = 780
    FaxLabel.Height = 360
End If
0
 

Author Comment

by:PstWood
ID: 12087782
That fixed it.
Thanks
RWW
0

Featured Post

Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Reference theme colors in VBA 4 24
Create tables in access db (2016)  using vba 13 41
Access on Mouse move 5 30
deduplicating based on criteria 2 21
In the previous article, Using a Critera Form to Filter Records (http://www.experts-exchange.com/A_6069.html), the form was basically a data container storing user input, which queries and other database objects could read. The form had to remain op…
Experts-Exchange is a great place to come for help with solutions for your database issues, and many problems are resolved within minutes of being posted.  Others take a little more time and effort and often providing a sample database is very helpf…
Familiarize people with the process of utilizing SQL Server views from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Microsoft Access…
Using Microsoft Access, learn some simple rules for how to construct tables in a relational database. Split up all multi-value fields into single values: Split up fields that belong to other things into separate tables: Make sure that all record…

785 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question