I am trying to accomplish the same thing for seleceting multiple month field from the list box. But when I select multiple month for searching records "Enter Parameter Value" prompt pops and asks for entering the same selected month from the list box. Though the results provides what's been selected from the list box but why do I also receive the "Enter parameter Value" prompt?
Any help provided would be appreciated!
Thanks!
I am using this code : Please let me know what i am doing wrong?....
Private Sub searchResults_Click()
On Error GoTo Err_searchResults_Click
Dim monthNames As String
Dim varRow As Variant
monthNames = ""
For Each varRow In LstMonth.ItemsSelected
monthNames = monthNames & "Month = " + LstMonth.ItemData(varRow) + " Or "
Next varRow
varRow = 0
monthNames = Left$(monthNames, Len(monthNames) - 3)
Dim stDocName As String
stDocName = "frmAdvanceSearchResults"
DoCmd.OpenForm stDocName, , , monthNames
Exit_searchResults_Click:
Exit Sub
Err_searchResults_Click:
MsgBox err.Description
Resume Exit_searchResults_Click
End Sub
And this is what i used in Query
SELECT AllReports.Author, *
FROM AllReports
WHERE (((AllReports.Author) Like "*" & IIf([Forms]![AdvanceSearch]![Author]<>"",[Forms]![AdvanceSearch]![Author],"*" & "*"

& "*"

AND ((AllReports.Month) Like IIf([Forms]![AdvanceSearch]![Month]<>"",[Forms]![AdvanceSearch]![Month],"*"

) AND ((AllReports.Year) Like IIf([Forms]![AdvanceSearch]![year]<>"",[Forms]![AdvanceSearch]![year],"*"

) AND ((AllReports.TypeOfReport) Like IIf([Forms]![AdvanceSearch]![TypeOfReport]<>"",[Forms]![AdvanceSearch]![TypeOfReport],"*"

) AND ((AllReports.ResearchArea) Like IIf([Forms]![AdvanceSearch]![ResearchArea]<>" ",[Forms]![AdvanceSearch]![ResearchArea],"*"

) AND ((AllReports.Title) Like "*" & IIf([Forms]![AdvanceSearch]![Title]<>"",[Forms]![AdvanceSearch]![Title],"*" & "*"

& "*"

AND ((AllReports.ReportNumber) Like "*" & IIf([Forms]![AdvanceSearch]![ReportNumber]<>"",[Forms]![AdvanceSearch]![ReportNumber],"*" & "*"

& "*"

AND ((AllReports.Keywords) Like "*" & IIf([Forms]![AdvanceSearch]![Keywords]<>"",[Forms]![AdvanceSearch]![Keywords],"*" & "*"

& "*"

)
ORDER BY AllReports.Year DESC;