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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Hide empty fields on report

Status
Not open for further replies.

3699wat

Technical User
Sep 30, 2002
28
US
I have a report with multiple fields (textboxes and corresponding labels). They are all lined up horizontally one under the other. The form is bound to a table populated through a form. Not all fields will be populated on that form for each record. I would like to set a procedure on the OnOpen event (or any other suggestion?) of the report so that all empty field AND corresponding labels are not visible and so that all lines will move up so no gaps are left in between.
I know how to set code to make individual textboxes and labels not visible if empty, but like a way to do it for all the empty ones at one time.
 
Hi

To hide the controls, in the onformat event of the detail section

If Len(Trim(Nz(MyControl,"")))=0 Then
MyControl.Visible = False
Else
MyControl.Visible = True
End If

To make them all move up, I am not so sure about, you need to experiment with grow and can shrink property of the section and the controls Regards

Ken Reay
Freelance Solutions Developer
Boldon Information Systems Ltd
UK
 
Ken
I tried your code, but get a runtime error 424 - Object required. Any ideas? Do I need to declare anything?
Marcel
 
Another option is to insert a subreport based on a query for each record....

Then that way, it will only show the fields you want for each record of the table.
 
Hi

No you should not need to decalre anything, provided you substituted your control names for my dummy ones (ie MyControl) Regards

Ken Reay
Freelance Solutions Developer
Boldon Information Systems Ltd
UK
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top