D
Deb
I am trying to put together a query that will return only the records that
contain ALL of the criteria selected from a listbox rather than all of the
records that contain ANY of the criteria selected. I've tried a few
different approaches & may still be working in the wrong direction...
I'm using a Find Duplicates Query and attempting to set the duplicate value
equal to the number of items selected.
SELECT [Selections].[name], [Selections].[Region], [Selections].[TrainingType]
FROM Selections
WHERE (((Selections.name) In (SELECT [name] FROM [Selections] As Tmp GROUP
BY [name] HAVING Count(*)=CountSelections())))
ORDER BY [Selections].[name];
I've been unable to get my function (CountSelections()) statement to count
the number of selected criterion in the listbox. My most recent attempt
gives the error message "Object doesn't support this property or method" (It
was taken from a Sub statement example).
Function CountSelections()
Dim TrainingCount As Control
Set TrainingCount = Forms!Search!List2
With TrainingCount
If .ListCount > 1 Then
.ListRows = .ListCount
Else
.ListRows = 1
End If
End With
End Function
Any help would be greatly appreciated!
contain ALL of the criteria selected from a listbox rather than all of the
records that contain ANY of the criteria selected. I've tried a few
different approaches & may still be working in the wrong direction...
I'm using a Find Duplicates Query and attempting to set the duplicate value
equal to the number of items selected.
SELECT [Selections].[name], [Selections].[Region], [Selections].[TrainingType]
FROM Selections
WHERE (((Selections.name) In (SELECT [name] FROM [Selections] As Tmp GROUP
BY [name] HAVING Count(*)=CountSelections())))
ORDER BY [Selections].[name];
I've been unable to get my function (CountSelections()) statement to count
the number of selected criterion in the listbox. My most recent attempt
gives the error message "Object doesn't support this property or method" (It
was taken from a Sub statement example).
Function CountSelections()
Dim TrainingCount As Control
Set TrainingCount = Forms!Search!List2
With TrainingCount
If .ListCount > 1 Then
.ListRows = .ListCount
Else
.ListRows = 1
End If
End With
End Function
Any help would be greatly appreciated!