Well, if you don't mind writing a little bit of code in your report you
could do something like this in the Report Open Event and Detail Event:
************************************************** ****
Option Compare Database
Option Explicit
Dim RS As Recordset
Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
Text0 = RS(0)
RS.MoveNext
End Sub
Private Sub Report_Open(Cancel As Integer)
Dim frm As Form, ctl As Control,
Dim v As Variant, str1 As String, strSql As String
Set frm = Forms!Form1
Set ctl = frm!List16
For Each v In ctl.ItemsSelected
str1 = str1 & "'" & ctl.ItemData(v) & "',"
Next
str1 = Left(str1, Len(str1) - 1) 'get rid of last comma
Me.RecordSource = "Select fld1 From Table1 " _
& "Where fld1 In (" & str1 & ")"
strSql = "Select fld1 From Table1 " _
& "Where fld1 In (" & str1 & ")"
Set RS = CurrentDb.OpenRecordset(strSql)
End Sub
************************************************** ****
In this example, the report is not directly bound to a recordsource.
You set the recordsource in the Report_Open event. I am only using one
field from a table, but you could select multiple fields and you filter
this recordset from the selections on the listbox on your form (which is
list16 in my example). You can use the
DoCmd.OpenReport "Report1" statement
and when Report1 open it will automatically read the selections from the
listbox. Then say you have 5 fields in the detail section of your
report, they could be txt0, txt1, txt2, txt3, txt4 or maybe you named
them
txtID, txtRegion, txtName, txtAddress, txtPhone
In the Detail section you would do this:
Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
txtID = RS(0) 'or RS!ID
txtRegion = RS(1) 'or RS!Region
txtName = RS(2) 'or RS!Name
txtAddress = RS(3) 'or RS!Address
txtPhone = RS(4) 'or RS!Phone
RS.MoveNext
End Sub
And, of course, your sql statement in the report_open event would select
the same fields for the RecordSource and for the Recordset var (RS).
Rich
*** Sent via Developersdex
http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!