>
Const RName = "Transaction Report"
>Dim Name, WClause
>For Each Name In Me![List4].ItemsSelected
> WClause = "[list4] = '" & Name & "'"
>DoCmd.OpenReport ReportName:=RName, WhereCondition:=WClause, View:=acViewPreview
>
>Next
>For Name = 0 To Me![List4].ListCount - 1
> Me![List4].Selected(lrow:=Name) = False
>Next
>
>
>So list4 is a field in the report's data source?
>
>Seems to me, if you have selected all employees (meaning no filter) the WhereCondition should not be used. In which case, you could have two ways of calling the report, one with wherecondition if all items are not selected and one where the selected list is passed to wherecondition.
>
>list4 is the name of the listbox and it is populated by the empname field in the datasource. I want the user to be able to select any number of employees not just one or all. ex: If there are 10 employees and they want to report on 4 of them I want them to be able to do this.
Then WClause is not a valid SQL Where clause. A valid SQL Where clause would have the format: fieldname = 'Value' or some other operator like <>, >=, Like, In, etc.
Since you have the OpenReport call inside the loop, I would assume you want one report per employee chosen so the WClause could be constructed like this:
WClause = "[myFieldName] = '" & Name & "'"
HTH