I'm brand new to Access so I may be doing this completely wrong, but I have a separate query object I wrote and I am trying to only include records based on the deals that were multiselected on the form
On the form I have a button on click it is running the public function below:
It doesn't return any records. I've tried using the strSearch as a string in the IN() of the query, but that doesn't seem to work and when I run the query it just prompts me to enter a parameter for strSearch. I don't even know if I'm on the right path with the WHERE IN or if there is a better way to be doing this. Should I be writing/running the SQL query from the VBA instead of a separate object? If so, how do I embed the results of that query in a subform/subreport control of the form? Help PLEAAAAASE. Thanks.
Code:
SELECT tblIRRCashflow.DealName, tblIRRCashflow.Payment, vtblIRRCashflow.IRRDate
FROM tblIRRCashflow
WHERE tblIRRCashflow.DealID IN (arSelected);
On the form I have a button on click it is running the public function below:
Code:
Public Function ListSelectValue()
Dim varItem As Variant
Dim strSearch As String
Dim qrtext As String
Dim Task() As Double
Dim arSelected
For Each varItem In Forms!frmPerfTool!tboDeal.ItemsSelected
strSearch = strSearch & "," & Forms!frmPerfTool!tboDeal.ItemData(varItem)
Next varItem
If Len(strSearch) = 0 Then
Else
strSearch = Right(strSearch, Len(strSearch) - 1)
arSelected = Split(strSearch, ",")
End If
End Function
It doesn't return any records. I've tried using the strSearch as a string in the IN() of the query, but that doesn't seem to work and when I run the query it just prompts me to enter a parameter for strSearch. I don't even know if I'm on the right path with the WHERE IN or if there is a better way to be doing this. Should I be writing/running the SQL query from the VBA instead of a separate object? If so, how do I embed the results of that query in a subform/subreport control of the form? Help PLEAAAAASE. Thanks.