Remove List Box Border On Print Out

G

Guest

I'm having trouble getting ride of the border around my list box on the print
out. I have set the list box properties to transparent border and it does not
show up on the print preview. When I print the report the border is still
there. Any suggetions?
 
L

Larry Linson

Perhaps you have been reading a different set of documentation than I, but
ever since I have been placing ListBox and ComboBox Controls on Access
Forms, I have understood that their purpose was to allow the user to
interactively select a value or values. Because there is no interaction with
a Report, I've never had a need for a list box. I'd probably be doing
something similar using a Subreport and have never had any trouble setting
the properties of Subreports.

Larry Linson
Microsoft Access MVP
 
G

Guest

Thank you Larry.

I was wondering if I was using the wrong methode. I sounds like I should be
using a text box or a subreport. I will try that instead.
 
G

Guest

Larry - you have a point about list boxes and their purpose, etc, but there
is a solution:

Create a Label control on the report then use the following code to populate
it with the items in the ListBox. The ListBox must stay on the report, you
can set its visible property to "No."

Add this code to the "On format" event of the Detail section, for example.
The If statement accomodates any null result sets returned by the ListBox:

ListBox.Requery

Dim myItems As Long
Dim Item As String

myItems = ListBox.ListCount

If myItems = 0 Then
Label.Caption = ""
Else
Item = ListBox.ItemData(0)
Label.Caption = Item
For x = 1 To myItems - 1
Item = Item & vbCrLf & ListBox.ItemData(x)
Label.Caption = Item
Next x
End If

....Make sure you make the label tall enough to account for all the data.
 

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