Multi-select List Boxes

  • Thread starter Thread starter Mary
  • Start date Start date
M

Mary

I'm new to using multi-select boxes. I have several set
up on a form. I'd like to be able to make selections from
each list, then run a report based on the selections.
The lists are set up and I am able to select multiple
items or "ALL". Is there an article on the next step to
bring it all together? I'm thinking I need a button that
will run the query or report based on the selections
made. If the results could be automatically formatted in
an Excel spreadsheet, that would be even better, but a
query or report would be fine. Any help is greatly
appreciated!
 
You will need to provide the information via code to filter the report's
recordsource query. Something like this, perhaps:

Dim strRptFilterAs String
Dim lngLoop As Long
strRptFilter= ""
For lngLoop = 0 - [LBX-Departments].ColumnHeads To
[LBX-Departments].ListCount - 1
If [LBX-Departments].Selected(lngLoop) = True Then _
strRptFilter = strRptFilter & "FieldName=" & _
[LBX-Departments].ItemData(lngLoop) & " Or "
Next lngLoop
If Len(strRptFilter) > 4 Then strRptFilter = Left(strRptFilter,
Len(strRptFilter) - 4)
DoCmd.OpenReport "ReportName", , , strRptFilter
 
Back
Top