Hi,
I need to get values out of a recordset in order to filter a second sqlstring
I constructed a filter query and get the records out of it in the first SQLstring in order to use the values to filter the second SQLstring. Unfortunately, when I set CountryCurveSelect = recordset.Fields(C).Values, there are no items to be found...I also tried
with recordset.getrows but that also gives problems probably due to the
multidimensionality of the variant.
Here is what I set up
What am I doing wrong?
I need to get values out of a recordset in order to filter a second sqlstring
I constructed a filter query and get the records out of it in the first SQLstring in order to use the values to filter the second SQLstring. Unfortunately, when I set CountryCurveSelect = recordset.Fields(C).Values, there are no items to be found...I also tried
with recordset.getrows but that also gives problems probably due to the
multidimensionality of the variant.
Here is what I set up
Code:
' Loop through the countries until predefined Number of Countries (NC) is
reached
For C = 1 To NC
sqlstr = "Select [_Country Filter]![ID COUNTRY] from [_Country Filter]"
Set rsread = db.OpenRecordset(sqlstr)
rsread.MoveFirst
CountryCurveSelect = rsread.Fields(C).Values
rsread.Close
' Original curvesmoothing procedure
sqlstr = "Select * from [myTable] where [ID Country] = " &
CountryCurveSelect & ";"
Set rsread = db.OpenRecordset(sqlstr)
If rsread.BOF Then Resume Next ' No records retrieved
rsread.MoveLast
ValueCount = rsread.RecordCount
etc...
Next C
What am I doing wrong?