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

Reformatting over hidden boxes 2...

Status
Not open for further replies.

CMooreJr

Technical User
Feb 20, 2003
217
US
Sorry, didn't make myself clear earlier...my code is the following:

If IsNull(Lawson_Number_24) Then
Lawson_Number_24.Visible = False
Description24.Visible = False
UC24.Visible = False
UIC24.Visible = False
NU24.Visible = False
Else
Lawson_Number_24.Visible = True
Description24.Visible = True
UC24.Visible = True
UIC24.Visible = True
NU24.Visible = True
End If

(There are 24 sets of boxes on the report that may/may not be hidden!)When the report is generated, the proper fields are hidden if they are "Null". However, the report still allows for the space of the hidden boxes. Is there a way to overcome that? It makes my report incredibly long.

Sorry, I'm not a programmer, so I've tried things like
Description24.Delete (which of course didn't work!)


Thanks!
 
Here's some sample code which you should be able to use with a little bit of adaption:

Private Sub Report_Open(Cancel As Integer)
Const TwipsPerCm = 567
SectionHeightInCM = 1

TuckControlAway "YourControlName1"
TuckControlAway "YourControlName2"
R.Section(acDetail).Height = SectionHeightInCm * TwipsPerCm
End Sub

Function TuckControlAway(ControlName
Dim R As Report: Set R = Me
Dim C As Control: Set C = R(ControlName)
C.Top = 0: C.Left = 0: C.Visible = False
R.Section(acDetail).Height = DetailSectionSizeInCm * TwipsPerCm
End Function

Here's how it works:

When the report is opened, the OnOpen event grabs a bunch of controls which are not required, makes them non visible, and tucks them into the top left of the detail section. The size of the section is then "shrunk" by setting the appropriate property.

Note that I've "packaged" the code to be called on the OnOpen event, into a single function called TuckControlAway, which takes a single argument; the controlname to be "tucked". After all appropriate controls have been tucked, set the section height to whatever is appropriate.

Adaptations to this code might include iteration through the group of controls and tucking only for Null text fields etc.

Might also want to control the report width, and so on.

Hope this helps,


Steve Lewy
Solutions Developer
steve@lewycomputing.com.au
(dont cut corners or you'll go round in circles)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top