Shananarocks
New member
- Local time
- Today, 18:30
- Joined
- Feb 25, 2020
- Messages
- 5
I was just doing my own database and found that I can actually filter multivalue field using the IN() operator.
Basically I was filtering a multivalue field named "Workyears"
So the filter is:
rs.Filter = "[Workyears.value] IN" & "(" & wy & ")"
(since I gather that .value will string the result and a variable search will have to be found inside the string result. Hence the use of the IN() operator)
The variable "wy" (workyear) is obtained from a Combo box named Cbo_Workyear where it is bounded to Column 1 (eg. 2018, 2019, 2020, 2021 etc) where:
Dim wy As Long
wy = CLng(Me.Cbo_WorkYear)
Of course you should continue with the second recordset to filter to use the result.
Set rs_Filtered = rs.OpenRecordset()
Also both my recordsets are NOT dim as "recordset2 " (unless you are doing multivalue recordset looping as suggested by Microsoft)
Instead they remains as:
Dim rs as recordset
Dim rs_Filtered as recordset
Good Luck to those who endeavour in the crazy syntax world of Visual Basic.
Shananarocks
Basically I was filtering a multivalue field named "Workyears"
So the filter is:
rs.Filter = "[Workyears.value] IN" & "(" & wy & ")"
(since I gather that .value will string the result and a variable search will have to be found inside the string result. Hence the use of the IN() operator)
The variable "wy" (workyear) is obtained from a Combo box named Cbo_Workyear where it is bounded to Column 1 (eg. 2018, 2019, 2020, 2021 etc) where:
Dim wy As Long
wy = CLng(Me.Cbo_WorkYear)
Of course you should continue with the second recordset to filter to use the result.
Set rs_Filtered = rs.OpenRecordset()
Also both my recordsets are NOT dim as "recordset2 " (unless you are doing multivalue recordset looping as suggested by Microsoft)
Instead they remains as:
Dim rs as recordset
Dim rs_Filtered as recordset
Good Luck to those who endeavour in the crazy syntax world of Visual Basic.
Shananarocks
Last edited: