Private Sub Command12_Click()
On Error GoTo Err_VIEW_Click
Dim stDocName As String
Dim arrProducts()
Dim I As Long
With List16
ReDim arrProducts(.ItemsSelected.Count - 1)
For I = 0 To .ItemsSelected.Count - 1
arrProducts(I) = .ItemData(I)
Next I
End With
stDocName = "rptDetailByProductCode"
DoCmd.OpenReport stDocName, acPreview, , "[IM_PRODUCT_CODE] In ('" & Join(arrProducts, "','") & "')"
Exit_VIEW_Click:
Exit Sub
Err_VIEW_Click:
MsgBox Err.Description
Resume Exit_VIEW_Click
End Sub
how is your vba coding?
post the SQL statement of your query