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

multiple listbox value printing on report

Status
Not open for further replies.

DIRENE

Technical User
Jan 19, 2004
51
US
I have a form with a listbox(simple) and a command button on it. That on the click button I have the code:

Dim strWhere
strWhere = ""
Dim intI As Integer
With Me!lstSupChoice
For intI = 0 To .ListCount - 1
If .Selected(intI) Then
If strWhere = "" Then
strWhere = "OPTIONS = '" & .ItemData(intI) & "'"
Else
strWhere = strWhere & " or OPTIONS = '" & .ItemData(intI) & "'"
End If
End If
Next intI
End With
DoCmd.OpenReport "SupReport", acViewPreview, , strWhere

Which pulls more the one option of to the report. Is there a way to get them to stay together like:

xlt trim
spare tire
blue

Right now their space out like

xlt trim


spare tire



blue


Thanks

irene
 
Skip, Here is my code on the command button:

Private Sub btnViewSupReport_Click()
Dim strWhere
strWhere = ""
Dim intI As Integer
With Me!lstSupChoice



Me!label1.Caption = ""

For intI = 0 To Me!lstSupChoice.ListCount - 1
If (intI) Then

Me!label1.Caption = Me!label1.Caption & .ItemData(intI) & vbCrLf



If strWhere = "" Then
strWhere = "OPTIONS = '" & .ItemData(intI) & "'"
Else
strWhere = strWhere & " or OPTIONS = '" & .ItemData(intI) & "'"
End If
End If
Next intI
End With
DoCmd.OpenReport "SupReport", acViewPreview, , strWhere



End Sub
 
Skip, Thank you I how get the correct info on my form label. But I still have one more ??? How do I get it to print on my form.

Irene
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top