I have an issue with a database i'm trying to setup. I have manifests that I distribute out to drivers that do some Tech work for us and this database keeps all the locations, addresses, tech numbers, etc in order... Everything works fine except with a multi select list box.
The list box retrieves the information correctly into the report... The problem is that I want it to split the actual pages of the report into seperate pages by route.
There are several routes to one driver, but each page should be divided by its respective route name. Instead what it does, is merges all routes into the first route it picked up, so all stops would show under ROUTE 1 instead of being distributed to ROUTE 1, 2, 3 etc...
Below is the code for the command button that retrieves the selected items in the listbox...
Any help is appreciated. If you need the whole db let me know.
Expand|Select|Wrap|Line Numbers
- On Error GoTo Err_ReportManifest_Click
- Dim stDocName As String, stSelectedItems As Variant, stResult As String, iCounter As Integer, EmptyCheck As String
- iCounter = 1
- If List0.ItemsSelected.Count <> 0 Then
- For Each stSelectedItems In List0.ItemsSelected
- If iCounter < List0.ItemsSelected.Count Then
- stResult = stResult & "'" & List0.ItemData(stSelectedItems) & "', "
- iCounter = iCounter + 1
- Else
- stResult = stResult & "'" & List0.ItemData(stSelectedItems) & "'"
- End If
- Next stSelectedItems
- Else
- MsgBox "Nothing was selected.", vbCritical + vbOKOnly
- Exit Sub
- End If
- MsgBox stResult
- stDocName = "Manifest"
- DoCmd.OpenReport stDocName, acPreview
- With Reports![Manifest]
- .Filter = "TechQuery.Route IN (" & stResult & ")"
- .FilterOn = True
- End With
- Exit_ReportManifest_Click:
- Exit Sub
- Err_ReportManifest_Click:
- MsgBox Err.Description
- Resume Exit_ReportManifest_Click