Part III: More-Advanced Access Techniques
732
FIGURE 20.26
This report trick uses hidden unbound text boxes in the Detail section.
Set the following properties for txtSpacer, txtCounter, and the Detail section (see Table 20.1).
TABLE 20.1
Properties for the “Blank Line” Example
Control Property Value
txtSpacer Visible Yes
CanShrink Yes
txtCounter Visible No
RunningSum Over All
ControlSource =1
Detail1 CanShrink Yes
These properties effectively hide the unbound txtSpacer and txtCounter controls, and per-
mit these controls and the Detail section to shrink as necessary when the txtSpacer text-box
control is empty. Even though txtSpacer is visible to the user, Access shrinks it to 0 height if it
contains no data. The txtCounter control never needs any space because its Visible property
is set to No, hiding it from the user.
The last step is to enter the following code as the Detail section’s Format event procedure:
Sub Detail1_Format ()
If (Me!txtCounter Mod 5) = 0 Then
Me!txtSpacer = “ “
Else
Me!txtSpacer = Null
End If
End Sub