I have several reports that I need to compare a selection of records for. To do this, I have created a multiselect listbox and populated it with records from a database (100 records). What I want to do is select some or all of the records and open a report based on the selection. I have created a query that works in opening a few records. My problem is that it won't open a lot of records. Access tells me the filter would be too long. I can get about 25 records to work, but it takes a long time to process this. Opening the report the normal way is far quicker. Does anybody out there have a more efficient way of doing this? Here is what I am using.(Watch word wrap)
sSQL = "(("
For Each Item In Me.List0.ItemsSelected
sSQL = sSQL & "(Table_Facilities.Info_FacilityCode)=" & """" & Me.List0.ItemData(Item) & """ Or "
Next
sSQL = Mid(sSQL, 1, (Len(sSQL) - 4))
sSQL = sSQL & "))"
DoCmd.OpenReport "Barrier Free Access Information", acViewPreview, "", sSQL
sSQL = "(("
For Each Item In Me.List0.ItemsSelected
sSQL = sSQL & "(Table_Facilities.Info_FacilityCode)=" & """" & Me.List0.ItemData(Item) & """ Or "
Next
sSQL = Mid(sSQL, 1, (Len(sSQL) - 4))
sSQL = sSQL & "))"
DoCmd.OpenReport "Barrier Free Access Information", acViewPreview, "", sSQL