send listbox items to report

R

Rino

Greetings,

I am looking for someone that could help me with the following
situation.


I have a listbox on the form that contains x amount of rows that user
populates. I'd like to move all those rows to report in MS Access. Row
Source Type is based on Valuelist not on table/query.


However, I am only able to pass the selected row and this is the line I

entered in the control source of the text box in the Report:


For Quantity: =[Forms]![QuoteDetail]![lstResults2].Column(0) & "" &
Chr$(10)


Part Number: For Quantity:
=[Forms]![QuoteDetail]![lstResults2].Column(1) & "" & Chr$(10)


Description: For Quantity:
=[Forms]![QuoteDetail]![lstResults2].Column(2) & "" & Chr$(10)


Price: For Quantity: =[Forms]![QuoteDetail]![lstResults2].Column(3) &
"" & Chr$(10)


so the result in the report would look like this:
Quantity Part Number Description Price
1 SUPP-0118 blah blah blah $xxx


As I mentioned earlier I'd like to be able to pass all of the items to
the report. I also included following code in the "Report_Open" event
but for some reason it doesn't work...?


Dim i As Long
Dim str As String


With Me!lstResults2


For i = Abs(.ColumnHeads) To (.ListCount - 1)


str = "'" & .Column(0, i) & "' , " & _
"'" & .Column(1, i) & "' , " & _
"'" & .Column(2, i) & "' , " & _
"'" & .Column(3, i) & "'"


stDocName = "rptQuote"
DoCmd.OpenReport stDocName, acPreview


Next i


End With


-----------------------------------------------------


Please tell me what am I doing wrong. I am new to this kind of things
so please be gentle ;)


Thanks in advance


-Rino
 

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