G
Guest
Hi guys,
I hope you can help me out here.
I've got a simple multi-select listbox on a form.
I'd like to pass the selected records (as link criteria) so that another
form opens with only the selected records displayed. I'm stumped I'm afraid.
Can you explain how to achieve this?
I've tried various methods including this:
Dim stDocName As String
Dim stLinkCriteria As String
Dim Criteria As String
Dim i As Variant
' Build criteria string from selected items in list box.
Criteria = ""
For Each i In Me![lstVisits].ItemsSelected
If Criteria <> "" Then
Criteria = Criteria & " OR "
End If
Criteria = Criteria & "[ReportID]='" & Me![lstVisits].ItemData(i) & "'"
Next i
stDocName = "frm_InspectionReports"
stLinkCriteria = "[ReportID]=" & Criteria
DoCmd.OpenForm stDocName, , , stLinkCriteria
Any help would be really appreciated!
I hope you can help me out here.
I've got a simple multi-select listbox on a form.
I'd like to pass the selected records (as link criteria) so that another
form opens with only the selected records displayed. I'm stumped I'm afraid.
Can you explain how to achieve this?
I've tried various methods including this:
Dim stDocName As String
Dim stLinkCriteria As String
Dim Criteria As String
Dim i As Variant
' Build criteria string from selected items in list box.
Criteria = ""
For Each i In Me![lstVisits].ItemsSelected
If Criteria <> "" Then
Criteria = Criteria & " OR "
End If
Criteria = Criteria & "[ReportID]='" & Me![lstVisits].ItemData(i) & "'"
Next i
stDocName = "frm_InspectionReports"
stLinkCriteria = "[ReportID]=" & Criteria
DoCmd.OpenForm stDocName, , , stLinkCriteria
Any help would be really appreciated!