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!

Listbox solution

Status
Not open for further replies.

skate

Technical User
Nov 29, 2002
65
CA
Ok, I've come to the conclusion that there must not be a way to print values in my listbox in a report. I have a listbox that is filtered/populated depending on what letters I type in textbox (eg. find all entrie starting with "tri...") For each entry you can double click to open a form that lets you views the details for that entry. Now I want to print this list. I was thinking I would need some sort of loop??? All I want is to create a printout for the list generated, but I can't seem to find an answer. Maybe I should go about this a completely different way? Suggestions?
 
Hi!

To get the information out of the list box you can use the following code:

Dim intRow As Integer
Dim strInfo As String

strInfo = ""
For intRow = 0 To ListBox.ListCount - 1
If intRow = 0 Then
strInfo = ListBox.Column(0, intRow)
Else
strInfo = strInfo & "," & ListBox.Column(0, intRow)
End If
Next intRow

This will give you a comma delimited list in strInfo assuming that the information you are interested in is in the first column of the list box. You can then put the list in a text box on the form or in a global variable (whichever you prefer) so it can be read and parsed from the report.

hth
Jeff Bridgham
bridgham@purdue.edu
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top