How can i eliminate white space horizontally or vertically

Z

Zar

I have a report which has 7 labels and 7 associated checkboxes, these
are laid out horizontally going from left to right, with the labels on
one line and the checkboxes underneath, i've managed to use code so
that only the checkboxes that are ticked and there associated label
show up on the report, however this causes a lot of white spaces for
those that are not checked, is there a way to remove this white space?
I'm a novice with access so don't want anything complicated, if it's
not possible or complicated, i could relay the report to have the
labels and boxes vertically, if i did this would it make it easier to
remove the white space? and if so how? all help much appreciated!
 
D

Duane Hookom

This sounds a bit un-normalized. However, if you name your check boxes chk1,
chk2,...chk7 and the labels are attached to the check boxes, you can use
code in the On Format event of the section containing the controls.

Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
Dim lngLeft As Long
Dim intCount As Integer
Dim intWidth As Integer 'width of one control
Dim ctl As Control
lngLeft = Me("chk1").Left
intWidth = 1000
For intCount = 1 To 7
Set ctl = Me("chk" & intCount)
If ctl.Value = True Then
ctl.Visible = True
'move the checkbox
ctl.Left = lngLeft
'move the label
ctl.Controls(0).Left = lngLeft
'set the next horizontal position
lngLeft = lngLeft + intWidth
Else
ctl.Visible = False
End If
Next
End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top